Skip to content

Commit

Permalink
Major refactor complete-ish
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaargolo committed Jun 12, 2024
1 parent 114b937 commit 34a48c7
Show file tree
Hide file tree
Showing 176 changed files with 1,711 additions and 1,680 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blockentities.HeaterBlockEntity;
import io.github.lucaargolo.kibe.blockentity.HeaterBlockEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.items.Glider;
import io.github.lucaargolo.kibe.utils.GliderHelper;
import io.github.lucaargolo.kibe.item.Glider;
import io.github.lucaargolo.kibe.utils.helper.GliderHelper;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blockentities.BigTorchBlockEntity;
import io.github.lucaargolo.kibe.blockentity.BigTorchBlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockRenderView;
import net.minecraft.world.LightType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.items.OldItemCompendiumKt;
import io.github.lucaargolo.kibe.item.ItemCompendium;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.LeveledCauldronBlock;
Expand Down Expand Up @@ -30,22 +30,22 @@ public interface CauldronBehaviorMixin {

@Inject(at = @At("TAIL"), method = "registerBucketBehavior")
private static void registerWoodenBucketBehavior(Map<Item, CauldronBehavior> behavior, CallbackInfo ci) {
behavior.put(OldItemCompendiumKt.getWATER_WOODEN_BUCKET(), (state, world, pos, player, hand, stack) ->
behavior.put(ItemCompendium.INSTANCE.getWATER_WOODEN_BUCKET(), (state, world, pos, player, hand, stack) ->
fillCauldronWithWoodenBucket(world, pos, player, hand, stack, Blocks.WATER_CAULDRON.getDefaultState().with(LeveledCauldronBlock.LEVEL, 3), SoundEvents.ITEM_BUCKET_EMPTY)
);
}

@Inject(at = @At("TAIL"), method = "registerBehavior")
private static void registerWoodenBucketBehavior(CallbackInfo ci) {
CauldronBehavior.WATER_CAULDRON_BEHAVIOR.put(OldItemCompendiumKt.getWOODEN_BUCKET(), (state, world, pos, player, hand, stack) ->
CauldronBehavior.emptyCauldron(state, world, pos, player, hand, stack, new ItemStack(OldItemCompendiumKt.getWATER_WOODEN_BUCKET()), (statex) -> statex.get(LeveledCauldronBlock.LEVEL) == 3, SoundEvents.ITEM_BUCKET_FILL)
CauldronBehavior.WATER_CAULDRON_BEHAVIOR.put(ItemCompendium.INSTANCE.getWOODEN_BUCKET(), (state, world, pos, player, hand, stack) ->
CauldronBehavior.emptyCauldron(state, world, pos, player, hand, stack, new ItemStack(ItemCompendium.INSTANCE.getWATER_WOODEN_BUCKET()), (statex) -> statex.get(LeveledCauldronBlock.LEVEL) == 3, SoundEvents.ITEM_BUCKET_FILL)
);
}

private static ActionResult fillCauldronWithWoodenBucket(World world, BlockPos pos, PlayerEntity player, Hand hand, ItemStack stack, BlockState state, SoundEvent soundEvent) {
if (!world.isClient) {
Item item = stack.getItem();
player.setStackInHand(hand, ItemUsage.exchangeStack(stack, player, new ItemStack(OldItemCompendiumKt.getWOODEN_BUCKET())));
player.setStackInHand(hand, ItemUsage.exchangeStack(stack, player, new ItemStack(ItemCompendium.INSTANCE.getWOODEN_BUCKET())));
player.incrementStat(Stats.FILL_CAULDRON);
player.incrementStat(Stats.USED.getOrCreateStat(item));
world.setBlockState(pos, state);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.entities.EntityCompendium;
import io.github.lucaargolo.kibe.entities.ThrownTorchEntity;
import io.github.lucaargolo.kibe.entity.EntityCompendium;
import io.github.lucaargolo.kibe.entity.ThrownTorchEntity;
import io.github.lucaargolo.kibe.utils.SyncableBlockEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.network.ClientPlayNetworkHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.effects.EffectCompendium;
import io.github.lucaargolo.kibe.effect.EffectCompendium;
import net.minecraft.entity.mob.EndermanEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blocks.Elevator;
import io.github.lucaargolo.kibe.block.Elevator;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.sound.SoundCategory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.items.Glider;
import io.github.lucaargolo.kibe.item.Glider;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.VertexConsumerProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.utils.SpikeHelper;
import io.github.lucaargolo.kibe.utils.helper.SpikeHelper;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.HostileEntity;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/lucaargolo/kibe/mixin/ItemMixin.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.utils.TooltipHelperKt;
import io.github.lucaargolo.kibe.utils.helper.TooltipHelper;
import net.minecraft.block.Block;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.BlockItem;
Expand All @@ -22,7 +22,7 @@ public class ItemMixin {

@Inject(at = @At("HEAD"), method = "appendTooltip")
public void appendTooltip(ItemStack stack, World world, List<Text> tooltip, TooltipContext context, CallbackInfo info) {
Map<ItemConvertible, List<Text>> map = TooltipHelperKt.getTooltipRegistry();
Map<ItemConvertible, List<Text>> map = TooltipHelper.INSTANCE.getTooltipRegistry();
Item item = stack.getItem();
if(item instanceof BlockItem) {
Block block = ((BlockItem) item).getBlock();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blocks.Elevator;
import io.github.lucaargolo.kibe.items.Glider;
import io.github.lucaargolo.kibe.items.OldItemCompendiumKt;
import io.github.lucaargolo.kibe.items.SleepingBag;
import io.github.lucaargolo.kibe.block.Elevator;
import io.github.lucaargolo.kibe.item.Glider;
import io.github.lucaargolo.kibe.item.ItemCompendium;
import io.github.lucaargolo.kibe.item.SleepingBag;
import io.github.lucaargolo.kibe.utils.SlimeBounceHandler;
import io.github.lucaargolo.kibe.utils.SpikeHelper;
import io.github.lucaargolo.kibe.utils.helper.SpikeHelper;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
Expand Down Expand Up @@ -78,7 +78,7 @@ private void jump(CallbackInfo info) {
private void handleFallDamage(float fallDistance, float damageMultiplier, DamageSource source, CallbackInfoReturnable<Boolean> info) {
if((Object) this instanceof PlayerEntity) {
PlayerEntity player = ((PlayerEntity) ((Object) this));
if (player.getEquippedStack(EquipmentSlot.FEET).getItem() == OldItemCompendiumKt.getSLIME_BOOTS()) {
if (player.getEquippedStack(EquipmentSlot.FEET).getItem() == ItemCompendium.INSTANCE.getSLIME_BOOTS()) {
if(!isSneaking() && fallDistance > 2) {
this.fallDistance = 0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.effects.EffectCompendium;
import io.github.lucaargolo.kibe.effect.EffectCompendium;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.model.EntityModel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.effects.EffectCompendium;
import io.github.lucaargolo.kibe.items.OldItemCompendiumKt;
import io.github.lucaargolo.kibe.effect.EffectCompendium;
import io.github.lucaargolo.kibe.item.ItemCompendium;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.MobEntity;
Expand Down Expand Up @@ -31,7 +31,7 @@ public void cannotDespawn(CallbackInfoReturnable<Boolean> info) {

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isOf(Lnet/minecraft/item/Item;)Z", ordinal = 0), method = "interactWithItem", locals = LocalCapture.CAPTURE_FAILSOFT, cancellable = true)
public void method_29506(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir, ItemStack itemStack) {
if(itemStack.isOf(OldItemCompendiumKt.getGOLDEN_LASSO()) || itemStack.isOf(OldItemCompendiumKt.getCURSED_LASSO()) || itemStack.isOf(OldItemCompendiumKt.getDIAMOND_LASSO())) {
if(itemStack.isOf(ItemCompendium.INSTANCE.getGOLDEN_LASSO()) || itemStack.isOf(ItemCompendium.INSTANCE.getCURSED_LASSO()) || itemStack.isOf(ItemCompendium.INSTANCE.getDIAMOND_LASSO())) {
ActionResult actionResult = itemStack.useOnEntity(player, this, hand);
if (actionResult.isAccepted()) {
cir.setReturnValue(actionResult);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blocks.CursedDirt;
import io.github.lucaargolo.kibe.block.CursedDirt;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.MobSpawnerLogic;
import net.minecraft.world.World;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import io.github.ladysnake.pal.PlayerAbility;
import io.github.ladysnake.pal.impl.PlayerAbilityView;
import io.github.lucaargolo.kibe.KibeMod;
import io.github.lucaargolo.kibe.items.AbilityRing;
import io.github.lucaargolo.kibe.items.Glider;
import io.github.lucaargolo.kibe.items.OldItemCompendiumKt;
import io.github.lucaargolo.kibe.items.SleepingBag;
import io.github.lucaargolo.kibe.item.AbilityRing;
import io.github.lucaargolo.kibe.item.Glider;
import io.github.lucaargolo.kibe.item.ItemCompendium;
import io.github.lucaargolo.kibe.item.SleepingBag;
import io.github.lucaargolo.kibe.mixed.PlayerEntityMixed;
import io.github.lucaargolo.kibe.utils.GliderHelper;
import io.github.lucaargolo.kibe.utils.RingAbilitiesKt;
import io.github.lucaargolo.kibe.utils.SlimeBounceHandler;
import io.github.lucaargolo.kibe.utils.helper.AbilityHelper;
import io.github.lucaargolo.kibe.utils.helper.GliderHelper;
import kotlin.Pair;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
Expand Down Expand Up @@ -51,7 +51,7 @@ public List<Pair<ItemStack, Long>> getKibe_activeRingsList() {

@Inject(at = @At("TAIL"), method = "eatFood")
public void eatFood(World world, ItemStack stack, CallbackInfoReturnable<ItemStack> info) {
if(stack.getItem().equals(OldItemCompendiumKt.getCURSED_KIBE()) && !world.isClient) {
if(stack.getItem().equals(ItemCompendium.INSTANCE.getCURSED_KIBE()) && !world.isClient) {
int x = random.nextInt(64);
if(x == 0) kill();
}
Expand Down Expand Up @@ -175,9 +175,9 @@ private void tick(CallbackInfo info) {
}
//Ring logic
if(!getWorld().isClient && this instanceof PlayerAbilityView) {
for(PlayerAbility pa : RingAbilitiesKt.getPotionToAbilityMap().keySet()) {
for(PlayerAbility pa : AbilityHelper.INSTANCE.getABILITY_TO_EFFECT().keySet()) {
if(pa.isEnabledFor(player)) {
StatusEffect se = RingAbilitiesKt.getPotionToAbilityMap().get(pa);
StatusEffect se = AbilityHelper.INSTANCE.getABILITY_TO_EFFECT().get(pa);
StatusEffectInstance sei = new StatusEffectInstance(se, 100, 1, false, false, true);
player.addStatusEffect(sei);
}
Expand All @@ -196,15 +196,15 @@ private void tick(CallbackInfo info) {
AbilityRing.Companion.getRINGS().forEach(ring -> {
if (ringMap.containsKey(ring)) {
if (ringQnt == -1 || ringQnt <= KibeMod.INSTANCE.getCONFIG().getMiscellaneousModule().getMaxRingsPerPlayer()) {
RingAbilitiesKt.getRingAbilitySource().grantTo(player, ring.getAbility());
AbilityHelper.INSTANCE.getRING_SOURCE().grantTo(player, ring.getAbility());
for (ItemStack ringStack : ringMap.get(ring)) {
if (!ringStack.getOrCreateNbt().getBoolean(AbilityRing.UNIQUE)) {
ringStack.getOrCreateNbt().putBoolean(AbilityRing.UNIQUE, true);
}
}
} else {
if (RingAbilitiesKt.getRingAbilitySource().grants(player, ring.getAbility())) {
RingAbilitiesKt.getRingAbilitySource().revokeFrom(player, ring.getAbility());
if (AbilityHelper.INSTANCE.getRING_SOURCE().grants(player, ring.getAbility())) {
AbilityHelper.INSTANCE.getRING_SOURCE().revokeFrom(player, ring.getAbility());
}
for (ItemStack ringStack : ringMap.get(ring)) {
if (ringStack.getOrCreateNbt().getBoolean(AbilityRing.UNIQUE)) {
Expand All @@ -213,8 +213,8 @@ private void tick(CallbackInfo info) {
}
}
} else {
if (RingAbilitiesKt.getRingAbilitySource().grants(player, ring.getAbility())) {
RingAbilitiesKt.getRingAbilitySource().revokeFrom(player, ring.getAbility());
if (AbilityHelper.INSTANCE.getRING_SOURCE().grants(player, ring.getAbility())) {
AbilityHelper.INSTANCE.getRING_SOURCE().revokeFrom(player, ring.getAbility());
}
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.utils.GliderHelper;
import io.github.lucaargolo.kibe.utils.helper.GliderHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.VertexConsumerProvider;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blocks.OldBlockCompendiumKt;
import io.github.lucaargolo.kibe.block.BlockCompendium;
import net.minecraft.block.BlockState;
import net.minecraft.block.RedstoneWireBlock;
import net.minecraft.util.math.BlockPos;
Expand All @@ -15,7 +15,7 @@ public class RedstoneWireBlockMixin {

@Inject(method = "canRunOnTop", at = @At("HEAD"), cancellable = true)
private void allowWireOnFluidHoppers(BlockView world, BlockPos pos, BlockState floor, CallbackInfoReturnable<Boolean> ci) {
if (floor.isOf(OldBlockCompendiumKt.getFLUID_HOPPER())) {
if (floor.isOf(BlockCompendium.INSTANCE.getFLUID_HOPPER())) {
ci.setReturnValue(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.utils.ChunkLoaderState;
import io.github.lucaargolo.kibe.data.ChunkLoaderState;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongSet;
import net.minecraft.server.MinecraftServer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.items.OldItemCompendiumKt;
import io.github.lucaargolo.kibe.item.ItemCompendium;
import net.minecraft.inventory.RecipeInputInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.ShapedRecipe;
Expand All @@ -18,7 +18,7 @@ public abstract class ShapedRecipeMixin {

@Inject(at = @At("HEAD"), method = "matchesPattern", cancellable = true)
private void matchesSmall(RecipeInputInventory inv, int offsetX, int offsetY, boolean flipped, CallbackInfoReturnable<Boolean> cir) {
if(output.getItem() == OldItemCompendiumKt.getGLIDER_LEFT_WING() || output.getItem() == OldItemCompendiumKt.getGLIDER_RIGHT_WING()) {
if(output.getItem() == ItemCompendium.INSTANCE.getGLIDER_LEFT_WING() || output.getItem() == ItemCompendium.INSTANCE.getGLIDER_RIGHT_WING()) {
if(flipped) cir.setReturnValue(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blockentities.BigTorchBlockEntity;
import io.github.lucaargolo.kibe.blockentity.BigTorchBlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.utils.ChunkLoaderState;
import io.github.lucaargolo.kibe.data.ChunkLoaderState;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.server.world.ThreadedAnvilChunkStorage;
import net.minecraft.util.math.ChunkPos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blocks.OldBlockCompendiumKt;
import io.github.lucaargolo.kibe.block.BlockCompendium;
import net.minecraft.block.BlockState;
import net.minecraft.block.WitherRoseBlock;
import net.minecraft.util.math.BlockPos;
Expand All @@ -15,7 +15,7 @@ public class WitherRoseBlockMixin {

@Inject(at = @At("HEAD"), method = "canPlantOnTop", cancellable = true)
public void canPlantOnTop(BlockState floor, BlockView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
if(floor.isOf(OldBlockCompendiumKt.getCURSED_DIRT())) info.setReturnValue(true);
if(floor.isOf(BlockCompendium.INSTANCE.getCURSED_DIRT())) info.setReturnValue(true);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blockentities.DehumidifierBlockEntity;
import io.github.lucaargolo.kibe.blockentity.DehumidifierBlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.lucaargolo.kibe.mixin;

import io.github.lucaargolo.kibe.blockentities.DehumidifierBlockEntity;
import io.github.lucaargolo.kibe.blockentity.DehumidifierBlockEntity;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
Expand Down
Loading

0 comments on commit 34a48c7

Please sign in to comment.