diff --git a/src/main/java/com/sweetrpg/catherder/CatHerder.java b/src/main/java/com/sweetrpg/catherder/CatHerder.java index 2222f6bd..26b4613e 100644 --- a/src/main/java/com/sweetrpg/catherder/CatHerder.java +++ b/src/main/java/com/sweetrpg/catherder/CatHerder.java @@ -4,7 +4,7 @@ import com.sweetrpg.catherder.client.ClientSetup; import com.sweetrpg.catherder.client.entity.render.world.BedFinderRenderer; import com.sweetrpg.catherder.client.event.ClientEventHandler; -import com.sweetrpg.catherder.common.Capabilities; +import com.sweetrpg.catherder.common.lib.Capabilities; import com.sweetrpg.catherder.common.CommonSetup; import com.sweetrpg.catherder.common.addon.AddonManager; import com.sweetrpg.catherder.common.command.CatRespawnCommand; diff --git a/src/main/java/com/sweetrpg/catherder/common/CommonSetup.java b/src/main/java/com/sweetrpg/catherder/common/CommonSetup.java index eeb0e077..3245f8aa 100644 --- a/src/main/java/com/sweetrpg/catherder/common/CommonSetup.java +++ b/src/main/java/com/sweetrpg/catherder/common/CommonSetup.java @@ -1,17 +1,14 @@ package com.sweetrpg.catherder.common; import com.sweetrpg.catherder.api.feature.FoodHandler; -import com.sweetrpg.catherder.api.feature.InteractHandler; import com.sweetrpg.catherder.common.command.CatRespawnCommand; import com.sweetrpg.catherder.common.config.ConfigHandler; import com.sweetrpg.catherder.common.entity.CatEntity; -import com.sweetrpg.catherder.common.entity.FishFoodHandler; -import com.sweetrpg.catherder.common.entity.HelmetInteractHandler; -import com.sweetrpg.catherder.common.entity.MeatFoodHandler; +import com.sweetrpg.catherder.common.event.FishFoodHandler; import com.sweetrpg.catherder.common.network.PacketHandler; import com.sweetrpg.catherder.common.registry.ModItems; import com.sweetrpg.catherder.common.talent.HappyEaterTalent; -import com.sweetrpg.catherder.common.world.WildCropGeneration; +import com.sweetrpg.catherder.common.world.gen.WildCropGeneration; import net.minecraft.world.level.block.ComposterBlock; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; @@ -25,7 +22,7 @@ public static void init(final FMLCommonSetupEvent event) { FoodHandler.registerHandler(new FishFoodHandler()); FoodHandler.registerDynPredicate(HappyEaterTalent.INNER_DYN_PRED); - InteractHandler.registerHandler(new HelmetInteractHandler()); +// InteractHandler.registerHandler(new HelmetInteractHandler()); ConfigHandler.initTalentConfig(); CatRespawnCommand.registerSerilizers(); CatEntity.initDataParameters(); diff --git a/src/main/java/com/sweetrpg/catherder/common/entity/CatEntity.java b/src/main/java/com/sweetrpg/catherder/common/entity/CatEntity.java index 67bc0aff..cb73d6c7 100644 --- a/src/main/java/com/sweetrpg/catherder/common/entity/CatEntity.java +++ b/src/main/java/com/sweetrpg/catherder/common/entity/CatEntity.java @@ -17,7 +17,7 @@ import com.sweetrpg.catherder.common.entity.ai.CatLieOnBedGoal; import com.sweetrpg.catherder.common.entity.ai.CatSitOnBlockGoal; import com.sweetrpg.catherder.common.entity.ai.*; -import com.sweetrpg.catherder.common.entity.serializers.DimensionDependantArg; +import com.sweetrpg.catherder.common.entity.misc.DimensionDependentArg; import com.sweetrpg.catherder.common.entity.stats.StatsTracker; import com.sweetrpg.catherder.common.lib.Constants; import com.sweetrpg.catherder.common.registry.*; @@ -27,7 +27,6 @@ import com.sweetrpg.catherder.common.util.NBTUtil; import com.sweetrpg.catherder.common.util.Util; import com.sweetrpg.catherder.common.util.WorldUtil; -import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -45,7 +44,6 @@ import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.players.OldUsersConverter; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -126,9 +124,9 @@ public class CatEntity extends AbstractCatEntity { private static final Cache> CAT_LEVEL = Cache.make(() -> (EntityDataAccessor) SynchedEntityData.defineId(CatEntity.class, ModSerializers.CAT_LEVEL_SERIALIZER.get().getSerializer())); private static final Cache> GENDER = Cache.make(() -> (EntityDataAccessor) SynchedEntityData.defineId(CatEntity.class, ModSerializers.GENDER_SERIALIZER.get().getSerializer())); private static final Cache> MODE = Cache.make(() -> (EntityDataAccessor) SynchedEntityData.defineId(CatEntity.class, ModSerializers.MODE_SERIALIZER.get().getSerializer())); - private static final Cache>>> CAT_TREE_LOCATION = Cache.make(() -> (EntityDataAccessor>>) SynchedEntityData.defineId(CatEntity.class, ModSerializers.CAT_TREE_LOC_SERIALIZER.get().getSerializer())); - private static final Cache>>> CAT_BOWL_LOCATION = Cache.make(() -> (EntityDataAccessor>>) SynchedEntityData.defineId(CatEntity.class, ModSerializers.CAT_TREE_LOC_SERIALIZER.get().getSerializer())); - private static final Cache>>> LITTERBOX_LOCATION = Cache.make(() -> (EntityDataAccessor>>) SynchedEntityData.defineId(CatEntity.class, ModSerializers.CAT_TREE_LOC_SERIALIZER.get().getSerializer())); + private static final Cache>>> CAT_TREE_LOCATION = Cache.make(() -> (EntityDataAccessor>>) SynchedEntityData.defineId(CatEntity.class, ModSerializers.CAT_TREE_LOC_SERIALIZER.get().getSerializer())); + private static final Cache>>> CAT_BOWL_LOCATION = Cache.make(() -> (EntityDataAccessor>>) SynchedEntityData.defineId(CatEntity.class, ModSerializers.CAT_TREE_LOC_SERIALIZER.get().getSerializer())); + private static final Cache>>> LITTERBOX_LOCATION = Cache.make(() -> (EntityDataAccessor>>) SynchedEntityData.defineId(CatEntity.class, ModSerializers.CAT_TREE_LOC_SERIALIZER.get().getSerializer())); private static final Cache> ORIGINAL_BREED = Cache.make(() -> (EntityDataAccessor) SynchedEntityData.defineId(CatEntity.class, ModSerializers.ORIGINAL_BREED_SERIALIZER.get().getSerializer())); public final Map objects = new HashMap<>(); @@ -198,9 +196,9 @@ protected void defineSynchedData() { this.entityData.define(SIZE, (byte) 3); this.entityData.define(ORIGINAL_BREED_INT, 0); this.entityData.define(TOY_VARIANT, ItemStack.EMPTY); - this.entityData.define(CAT_TREE_LOCATION.get(), new DimensionDependantArg<>(() -> EntityDataSerializers.OPTIONAL_BLOCK_POS)); - this.entityData.define(CAT_BOWL_LOCATION.get(), new DimensionDependantArg<>(() -> EntityDataSerializers.OPTIONAL_BLOCK_POS)); - this.entityData.define(LITTERBOX_LOCATION.get(), new DimensionDependantArg<>(() -> EntityDataSerializers.OPTIONAL_BLOCK_POS)); + this.entityData.define(CAT_TREE_LOCATION.get(), new DimensionDependentArg<>(() -> EntityDataSerializers.OPTIONAL_BLOCK_POS)); + this.entityData.define(CAT_BOWL_LOCATION.get(), new DimensionDependentArg<>(() -> EntityDataSerializers.OPTIONAL_BLOCK_POS)); + this.entityData.define(LITTERBOX_LOCATION.get(), new DimensionDependentArg<>(() -> EntityDataSerializers.OPTIONAL_BLOCK_POS)); // this.entityData.define(IS_LYING, false); this.entityData.define(RELAX_STATE_ONE, false); } @@ -1309,7 +1307,7 @@ public void addAdditionalSaveData(CompoundTag compound) { compound.putInt("original_breed", this.getOriginalBreed()); NBTUtil.writeItemStack(compound, "fetchItem", this.getToyVariant()); - DimensionDependantArg> bedsData = this.entityData.get(CAT_TREE_LOCATION.get()); + DimensionDependentArg> bedsData = this.entityData.get(CAT_TREE_LOCATION.get()); if(!bedsData.isEmpty()) { ListTag bedsList = new ListTag(); @@ -1324,7 +1322,7 @@ public void addAdditionalSaveData(CompoundTag compound) { compound.put("beds", bedsList); } - DimensionDependantArg> bowlsData = this.entityData.get(CAT_BOWL_LOCATION.get()); + DimensionDependentArg> bowlsData = this.entityData.get(CAT_BOWL_LOCATION.get()); if(!bowlsData.isEmpty()) { ListTag bowlsList = new ListTag(); @@ -1555,7 +1553,7 @@ public void readAdditionalSaveData(CompoundTag compound) { } // cat tree - DimensionDependantArg> bedsData = this.entityData.get(CAT_TREE_LOCATION.get()).copyEmpty(); + DimensionDependentArg> bedsData = this.entityData.get(CAT_TREE_LOCATION.get()).copyEmpty(); try { if(compound.contains("beds", Tag.TAG_LIST)) { @@ -1578,7 +1576,7 @@ public void readAdditionalSaveData(CompoundTag compound) { this.entityData.set(CAT_TREE_LOCATION.get(), bedsData); // cat bowl - DimensionDependantArg> bowlsData = this.entityData.get(CAT_BOWL_LOCATION.get()).copyEmpty(); + DimensionDependentArg> bowlsData = this.entityData.get(CAT_BOWL_LOCATION.get()).copyEmpty(); try { if(compound.contains("bowls", Tag.TAG_LIST)) { @@ -1601,7 +1599,7 @@ public void readAdditionalSaveData(CompoundTag compound) { this.entityData.set(CAT_BOWL_LOCATION.get(), bowlsData); // litterbox - DimensionDependantArg> litterboxData = this.entityData.get(LITTERBOX_LOCATION.get()).copyEmpty(); + DimensionDependentArg> litterboxData = this.entityData.get(LITTERBOX_LOCATION.get()).copyEmpty(); try { if(compound.contains("litterbox", Tag.TAG_LIST)) { diff --git a/src/main/java/com/sweetrpg/catherder/common/entity/HelmetInteractHandler.java b/src/main/java/com/sweetrpg/catherder/common/entity/HelmetInteractHandler.java deleted file mode 100644 index f8a2c251..00000000 --- a/src/main/java/com/sweetrpg/catherder/common/entity/HelmetInteractHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.sweetrpg.catherder.common.entity; - -import com.google.common.collect.ImmutableMap; -import com.sweetrpg.catherder.common.registry.ModAccessories; -import com.sweetrpg.catherder.api.registry.Accessory; -import com.sweetrpg.catherder.api.registry.AccessoryInstance; -import com.sweetrpg.catherder.api.inferface.AbstractCatEntity; -import com.sweetrpg.catherder.api.inferface.ICatItem; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.Level; -import net.minecraftforge.registries.RegistryObject; -import net.minecraftforge.registries.IRegistryDelegate; - -import java.util.Map; - -public class HelmetInteractHandler implements ICatItem { - - private static final Map, RegistryObject> MAPPING = new ImmutableMap.Builder, RegistryObject>() -// .put(Items.IRON_HELMET.delegate, CatAccessories.IRON_HELMET) -// .put(Items.DIAMOND_HELMET.delegate, CatAccessories.DIAMOND_HELMET) -// .put(Items.GOLDEN_HELMET.delegate, CatAccessories.GOLDEN_HELMET) -// .put(Items.CHAINMAIL_HELMET.delegate, CatAccessories.CHAINMAIL_HELMET) -// .put(Items.TURTLE_HELMET.delegate, CatAccessories.TURTLE_HELMET) -// .put(Items.NETHERITE_HELMET.delegate, CatAccessories.NETHERITE_HELMET) -// .put(Items.IRON_BOOTS.delegate, CatAccessories.IRON_BOOTS) -// .put(Items.DIAMOND_BOOTS.delegate, CatAccessories.DIAMOND_BOOTS) -// .put(Items.GOLDEN_BOOTS.delegate, CatAccessories.GOLDEN_BOOTS) -// .put(Items.CHAINMAIL_BOOTS.delegate, CatAccessories.CHAINMAIL_BOOTS) -// .put(Items.NETHERITE_BOOTS.delegate, CatAccessories.NETHERITE_BOOTS) -// .put(Items.IRON_CHESTPLATE.delegate, CatAccessories.IRON_BODY_PIECE) -// .put(Items.DIAMOND_CHESTPLATE.delegate, CatAccessories.DIAMOND_BODY_PIECE) -// .put(Items.GOLDEN_CHESTPLATE.delegate, CatAccessories.GOLDEN_BODY_PIECE) -// .put(Items.CHAINMAIL_CHESTPLATE.delegate, CatAccessories.CHAINMAIL_BODY_PIECE) -// .put(Items.NETHERITE_CHESTPLATE.delegate, CatAccessories.NETHERITE_BODY_PIECE) -// .put(Items.LEATHER_HELMET.delegate, CatAccessories.LEATHER_HELMET) - .put(Items.LEATHER_BOOTS.delegate, ModAccessories.LEATHER_BOOTS) -// .put(Items.LEATHER_CHESTPLATE.delegate, CatAccessories.LEATHER_BODY_PIECE) - .build(); - - @Override - public InteractionResult processInteract(AbstractCatEntity catIn, Level worldIn, Player playerIn, InteractionHand handIn) { - if (catIn.isTame() && catIn.canInteract(playerIn)) { - ItemStack stack = playerIn.getItemInHand(handIn); - - if (!stack.isEmpty()) { - RegistryObject associatedAccessory = MAPPING.get(stack.getItem().delegate); - - if (associatedAccessory != null) { - AccessoryInstance inst = associatedAccessory.get().createFromStack(stack.copy().split(1)); - - if (catIn.addAccessory(inst)) { - catIn.consumeItemFromStack(playerIn, stack); - return InteractionResult.SUCCESS; - } - } - } - } - - return InteractionResult.PASS; - } - -} diff --git a/src/main/java/com/sweetrpg/catherder/common/entity/accessory/Helmet.java b/src/main/java/com/sweetrpg/catherder/common/entity/accessory/Helmet.java deleted file mode 100644 index 8b3d5195..00000000 --- a/src/main/java/com/sweetrpg/catherder/common/entity/accessory/Helmet.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.sweetrpg.catherder.common.entity.accessory; - -import com.sweetrpg.catherder.common.registry.ModAccessoryTypes; -import net.minecraft.world.level.ItemLike; - -import java.util.function.Supplier; - -public class Helmet extends ArmourAccessory { - - public Helmet(Supplier itemIn) { - super(ModAccessoryTypes.HEAD, itemIn); - } - -} diff --git a/src/main/java/com/sweetrpg/catherder/common/entity/accessory/LeatherArmourAccessory.java b/src/main/java/com/sweetrpg/catherder/common/entity/accessory/LeatherArmourAccessory.java deleted file mode 100644 index a4f7234a..00000000 --- a/src/main/java/com/sweetrpg/catherder/common/entity/accessory/LeatherArmourAccessory.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.sweetrpg.catherder.common.entity.accessory; - -import com.sweetrpg.catherder.api.inferface.IColoredObject; -import com.sweetrpg.catherder.api.registry.AccessoryInstance; -import com.sweetrpg.catherder.api.registry.AccessoryType; -import com.sweetrpg.catherder.common.util.ColorCache; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.DyeableLeatherItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.ItemLike; - -import java.util.function.Supplier; - -public class LeatherArmourAccessory extends ArmourAccessory { - - public LeatherArmourAccessory(Supplier typeIn, Supplier itemIn) { - super(typeIn, itemIn); - } - - @Override - public AccessoryInstance create(ItemStack armourStack) { - if (armourStack.isEmpty()) { -// if (this.of(CatAccessories.LEATHER_HELMET)) { -// armourStack = new ItemStack(Items.LEATHER_HELMET); -// } else { -// throw new IllegalArgumentException(); -// } - } - - return new LeatherArmourAccessory.Instance(armourStack.copy()); - } - - @Override - public AccessoryInstance read(CompoundTag compound) { - AccessoryInstance inst = super.read(compound); - -// if (this.of(CatAccessories.LEATHER_HELMET)) { -// // Backwards compatibility -// if (compound.contains("color", Tag.TAG_ANY_NUMERIC)) { -// int color = compound.getInt("color"); -// -// Instance def = inst.cast(Instance.class); -// if (def.armourStack.getItem() instanceof DyeableLeatherItem) { -// ((DyeableLeatherItem) def.armourStack.getItem()).setColor(def.armourStack, color); -// } -// -// def.color = ColourCache.make(color); -// } -// } - - return inst; - } - - public class Instance extends ArmourAccessory.Instance implements IColoredObject { - - private ColorCache color = ColorCache.WHITE; - - public Instance(ItemStack armourStack) { - super(armourStack); - - if (armourStack.getItem() instanceof DyeableLeatherItem) { - this.color = ColorCache.make(((DyeableLeatherItem) armourStack.getItem()).getColor(armourStack)); - } - } - - @Override - public AccessoryInstance copy() { - return new LeatherArmourAccessory.Instance(this.armourStack.copy()); - } - - @Override - public float[] getColor() { - return this.color.getFloatArray(); - } - } -} diff --git a/src/main/java/com/sweetrpg/catherder/common/entity/accessory/LeatherHelmet.java b/src/main/java/com/sweetrpg/catherder/common/entity/accessory/LeatherHelmet.java deleted file mode 100644 index e8c9cbcb..00000000 --- a/src/main/java/com/sweetrpg/catherder/common/entity/accessory/LeatherHelmet.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.sweetrpg.catherder.common.entity.accessory; - -import com.sweetrpg.catherder.common.registry.ModAccessoryTypes; -import com.sweetrpg.catherder.api.registry.AccessoryInstance; -import net.minecraft.world.level.ItemLike; - -import java.util.function.Supplier; - -public class LeatherHelmet extends DyeableAccessory { - - public LeatherHelmet(Supplier itemIn) { - super(ModAccessoryTypes.HEAD, itemIn); - } - - @Override - public byte getRenderLayer() { - return AccessoryInstance.RENDER_TOP; - } -} diff --git a/src/main/java/com/sweetrpg/catherder/common/entity/serializers/DimensionDependantArg.java b/src/main/java/com/sweetrpg/catherder/common/entity/misc/DimensionDependentArg.java similarity index 79% rename from src/main/java/com/sweetrpg/catherder/common/entity/serializers/DimensionDependantArg.java rename to src/main/java/com/sweetrpg/catherder/common/entity/misc/DimensionDependentArg.java index be210a16..4d029c4f 100644 --- a/src/main/java/com/sweetrpg/catherder/common/entity/serializers/DimensionDependantArg.java +++ b/src/main/java/com/sweetrpg/catherder/common/entity/misc/DimensionDependentArg.java @@ -1,4 +1,4 @@ -package com.sweetrpg.catherder.common.entity.serializers; +package com.sweetrpg.catherder.common.entity.misc; import net.minecraft.network.syncher.EntityDataSerializer; import net.minecraft.resources.ResourceKey; @@ -7,13 +7,13 @@ import java.util.*; import java.util.function.Supplier; -public class DimensionDependantArg implements Map, T> { +public class DimensionDependentArg implements Map, T> { private Supplier> serializer; public Map, T> map = new HashMap<>(); - public DimensionDependantArg(Supplier> serializer) { + public DimensionDependentArg(Supplier> serializer) { this.serializer = serializer; } @@ -36,17 +36,17 @@ public EntityDataSerializer getSerializer() { return this.serializer.get(); } - public DimensionDependantArg copy() { - DimensionDependantArg clone = new DimensionDependantArg<>(this.serializer); + public DimensionDependentArg copy() { + DimensionDependentArg clone = new DimensionDependentArg<>(this.serializer); clone.map.putAll(this.map); return clone; } - public DimensionDependantArg copyEmpty() { - return new DimensionDependantArg<>(this.serializer); + public DimensionDependentArg copyEmpty() { + return new DimensionDependentArg<>(this.serializer); } - public DimensionDependantArg set(ResourceKey dim, T value) { + public DimensionDependentArg set(ResourceKey dim, T value) { this.put(dim, value); return this; } @@ -65,10 +65,10 @@ public String toString() { public boolean equals(Object obj) { if (obj.getClass() != this.getClass()) { return false; - } else if (!(obj instanceof DimensionDependantArg)) { + } else if (!(obj instanceof DimensionDependentArg)) { return false; } else { - DimensionDependantArg other = (DimensionDependantArg) obj; + DimensionDependentArg other = (DimensionDependentArg) obj; return this.map.equals(other.map); } } diff --git a/src/main/java/com/sweetrpg/catherder/common/entity/serializers/TreeLocationsSerializer.java b/src/main/java/com/sweetrpg/catherder/common/entity/serializers/TreeLocationsSerializer.java index ac67d094..a5a6ac98 100644 --- a/src/main/java/com/sweetrpg/catherder/common/entity/serializers/TreeLocationsSerializer.java +++ b/src/main/java/com/sweetrpg/catherder/common/entity/serializers/TreeLocationsSerializer.java @@ -1,5 +1,6 @@ package com.sweetrpg.catherder.common.entity.serializers; +import com.sweetrpg.catherder.common.entity.misc.DimensionDependentArg; import net.minecraft.core.Registry; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.syncher.EntityDataSerializer; @@ -8,10 +9,10 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.Level; -public class TreeLocationsSerializer> implements EntityDataSerializer> { +public class TreeLocationsSerializer> implements EntityDataSerializer> { @Override - public void write(FriendlyByteBuf buf, DimensionDependantArg value) { + public void write(FriendlyByteBuf buf, DimensionDependentArg value) { EntityDataSerializer ser = value.getSerializer(); buf.writeInt(EntityDataSerializers.getSerializedId(ser)); buf.writeInt(value.size()); @@ -22,9 +23,9 @@ public void write(FriendlyByteBuf buf, DimensionDependantArg value) { } @Override - public DimensionDependantArg read(FriendlyByteBuf buf) { + public DimensionDependentArg read(FriendlyByteBuf buf) { EntityDataSerializer ser = (EntityDataSerializer) EntityDataSerializers.getSerializer(buf.readInt()); - DimensionDependantArg value = new DimensionDependantArg<>(() -> ser); + DimensionDependentArg value = new DimensionDependentArg<>(() -> ser); int size = buf.readInt(); for (int i = 0; i < size; i++) { @@ -38,7 +39,7 @@ public DimensionDependantArg read(FriendlyByteBuf buf) { } @Override - public DimensionDependantArg copy(DimensionDependantArg value) { + public DimensionDependentArg copy(DimensionDependentArg value) { return value.copy(); } } diff --git a/src/main/java/com/sweetrpg/catherder/common/event/EventHandler.java b/src/main/java/com/sweetrpg/catherder/common/event/EventHandler.java index ca7eef0c..576c9d18 100644 --- a/src/main/java/com/sweetrpg/catherder/common/event/EventHandler.java +++ b/src/main/java/com/sweetrpg/catherder/common/event/EventHandler.java @@ -6,7 +6,7 @@ import com.sweetrpg.catherder.common.registry.ModEntityTypes; import com.sweetrpg.catherder.common.registry.ModItems; import com.sweetrpg.catherder.common.talent.TomcatTalent; -import com.sweetrpg.catherder.common.world.WildCropGeneration; +import com.sweetrpg.catherder.common.world.gen.WildCropGeneration; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; diff --git a/src/main/java/com/sweetrpg/catherder/common/entity/FishFoodHandler.java b/src/main/java/com/sweetrpg/catherder/common/event/FishFoodHandler.java similarity index 96% rename from src/main/java/com/sweetrpg/catherder/common/entity/FishFoodHandler.java rename to src/main/java/com/sweetrpg/catherder/common/event/FishFoodHandler.java index 765bd5dd..4e53a094 100644 --- a/src/main/java/com/sweetrpg/catherder/common/entity/FishFoodHandler.java +++ b/src/main/java/com/sweetrpg/catherder/common/event/FishFoodHandler.java @@ -1,4 +1,4 @@ -package com.sweetrpg.catherder.common.entity; +package com.sweetrpg.catherder.common.event; import com.sweetrpg.catherder.api.inferface.AbstractCatEntity; import com.sweetrpg.catherder.api.inferface.ICatFoodHandler; diff --git a/src/main/java/com/sweetrpg/catherder/common/event/HelmetInteractHandler.java b/src/main/java/com/sweetrpg/catherder/common/event/HelmetInteractHandler.java new file mode 100644 index 00000000..68022bea --- /dev/null +++ b/src/main/java/com/sweetrpg/catherder/common/event/HelmetInteractHandler.java @@ -0,0 +1,67 @@ +//package com.sweetrpg.catherder.common.event; +// +//import com.google.common.collect.ImmutableMap; +//import com.sweetrpg.catherder.common.registry.ModAccessories; +//import com.sweetrpg.catherder.api.registry.Accessory; +//import com.sweetrpg.catherder.api.registry.AccessoryInstance; +//import com.sweetrpg.catherder.api.inferface.AbstractCatEntity; +//import com.sweetrpg.catherder.api.inferface.ICatItem; +//import net.minecraft.world.InteractionHand; +//import net.minecraft.world.InteractionResult; +//import net.minecraft.world.entity.player.Player; +//import net.minecraft.world.item.Item; +//import net.minecraft.world.item.ItemStack; +//import net.minecraft.world.item.Items; +//import net.minecraft.world.level.Level; +//import net.minecraftforge.registries.RegistryObject; +//import net.minecraftforge.registries.IRegistryDelegate; +// +//import java.util.Map; +// +//public class HelmetInteractHandler implements ICatItem { +// +// private static final Map, RegistryObject> MAPPING = new ImmutableMap.Builder, RegistryObject>() +//// .put(Items.IRON_HELMET.delegate, CatAccessories.IRON_HELMET) +//// .put(Items.DIAMOND_HELMET.delegate, CatAccessories.DIAMOND_HELMET) +//// .put(Items.GOLDEN_HELMET.delegate, CatAccessories.GOLDEN_HELMET) +//// .put(Items.CHAINMAIL_HELMET.delegate, CatAccessories.CHAINMAIL_HELMET) +//// .put(Items.TURTLE_HELMET.delegate, CatAccessories.TURTLE_HELMET) +//// .put(Items.NETHERITE_HELMET.delegate, CatAccessories.NETHERITE_HELMET) +//// .put(Items.IRON_BOOTS.delegate, CatAccessories.IRON_BOOTS) +//// .put(Items.DIAMOND_BOOTS.delegate, CatAccessories.DIAMOND_BOOTS) +//// .put(Items.GOLDEN_BOOTS.delegate, CatAccessories.GOLDEN_BOOTS) +//// .put(Items.CHAINMAIL_BOOTS.delegate, CatAccessories.CHAINMAIL_BOOTS) +//// .put(Items.NETHERITE_BOOTS.delegate, CatAccessories.NETHERITE_BOOTS) +//// .put(Items.IRON_CHESTPLATE.delegate, CatAccessories.IRON_BODY_PIECE) +//// .put(Items.DIAMOND_CHESTPLATE.delegate, CatAccessories.DIAMOND_BODY_PIECE) +//// .put(Items.GOLDEN_CHESTPLATE.delegate, CatAccessories.GOLDEN_BODY_PIECE) +//// .put(Items.CHAINMAIL_CHESTPLATE.delegate, CatAccessories.CHAINMAIL_BODY_PIECE) +//// .put(Items.NETHERITE_CHESTPLATE.delegate, CatAccessories.NETHERITE_BODY_PIECE) +//// .put(Items.LEATHER_HELMET.delegate, CatAccessories.LEATHER_HELMET) +//// .put(Items.LEATHER_BOOTS.delegate, ModAccessories.LEATHER_BOOTS) +//// .put(Items.LEATHER_CHESTPLATE.delegate, CatAccessories.LEATHER_BODY_PIECE) +// .build(); +// +// @Override +// public InteractionResult processInteract(AbstractCatEntity catIn, Level worldIn, Player playerIn, InteractionHand handIn) { +// if (catIn.isTame() && catIn.canInteract(playerIn)) { +// ItemStack stack = playerIn.getItemInHand(handIn); +// +// if (!stack.isEmpty()) { +// RegistryObject associatedAccessory = MAPPING.get(stack.getItem().delegate); +// +// if (associatedAccessory != null) { +// AccessoryInstance inst = associatedAccessory.get().createFromStack(stack.copy().split(1)); +// +// if (catIn.addAccessory(inst)) { +// catIn.consumeItemFromStack(playerIn, stack); +// return InteractionResult.SUCCESS; +// } +// } +// } +// } +// +// return InteractionResult.PASS; +// } +// +//} diff --git a/src/main/java/com/sweetrpg/catherder/common/entity/MeatFoodHandler.java b/src/main/java/com/sweetrpg/catherder/common/event/MeatFoodHandler.java similarity index 88% rename from src/main/java/com/sweetrpg/catherder/common/entity/MeatFoodHandler.java rename to src/main/java/com/sweetrpg/catherder/common/event/MeatFoodHandler.java index 80d0a656..5bfee0de 100644 --- a/src/main/java/com/sweetrpg/catherder/common/entity/MeatFoodHandler.java +++ b/src/main/java/com/sweetrpg/catherder/common/event/MeatFoodHandler.java @@ -1,4 +1,4 @@ -package com.sweetrpg.catherder.common.entity; +package com.sweetrpg.catherder.common.event; import com.sweetrpg.catherder.api.inferface.AbstractCatEntity; import com.sweetrpg.catherder.api.inferface.ICatFoodHandler; @@ -22,8 +22,8 @@ public boolean canConsume(AbstractCatEntity catIn, ItemStack stackIn, Entity ent @Override public InteractionResult consume(AbstractCatEntity catIn, ItemStack stackIn, Entity entityIn) { - if (catIn.getCatHunger() < catIn.getMaxHunger()) { - if (!catIn.level.isClientSide) { + if(catIn.getCatHunger() < catIn.getMaxHunger()) { + if(!catIn.level.isClientSide) { int heal = stackIn.getItem().getFoodProperties().getNutrition() * 5; catIn.setCatHunger(catIn.getCatHunger() + heal); diff --git a/src/main/java/com/sweetrpg/catherder/common/Capabilities.java b/src/main/java/com/sweetrpg/catherder/common/lib/Capabilities.java similarity index 87% rename from src/main/java/com/sweetrpg/catherder/common/Capabilities.java rename to src/main/java/com/sweetrpg/catherder/common/lib/Capabilities.java index e708b864..cf2ede29 100644 --- a/src/main/java/com/sweetrpg/catherder/common/Capabilities.java +++ b/src/main/java/com/sweetrpg/catherder/common/lib/Capabilities.java @@ -1,4 +1,4 @@ -package com.sweetrpg.catherder.common; +package com.sweetrpg.catherder.common.lib; import com.sweetrpg.catherder.common.inventory.PackCatItemHandler; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; diff --git a/src/main/java/com/sweetrpg/catherder/common/FoodValues.java b/src/main/java/com/sweetrpg/catherder/common/lib/FoodValues.java similarity index 86% rename from src/main/java/com/sweetrpg/catherder/common/FoodValues.java rename to src/main/java/com/sweetrpg/catherder/common/lib/FoodValues.java index 8e2ef155..e033666a 100644 --- a/src/main/java/com/sweetrpg/catherder/common/FoodValues.java +++ b/src/main/java/com/sweetrpg/catherder/common/lib/FoodValues.java @@ -1,4 +1,4 @@ -package com.sweetrpg.catherder.common; +package com.sweetrpg.catherder.common.lib; import net.minecraft.world.food.FoodProperties; diff --git a/src/main/java/com/sweetrpg/catherder/common/registry/ModAccessories.java b/src/main/java/com/sweetrpg/catherder/common/registry/ModAccessories.java index 7423fa2b..c8ded00e 100644 --- a/src/main/java/com/sweetrpg/catherder/common/registry/ModAccessories.java +++ b/src/main/java/com/sweetrpg/catherder/common/registry/ModAccessories.java @@ -49,11 +49,11 @@ public class ModAccessories { // // public static final RegistryObject LEATHER_HELMET = register("leather_helmet", () -> new LeatherArmourAccessory(CatAccessoryTypes.HEAD, Items.LEATHER_HELMET.delegate).setModelTexture(Resources.LEATHER_HELMET)); // public static final RegistryObject LEATHER_BODY_PIECE = register("leather_body_piece", () -> new LeatherArmourAccessory(CatAccessoryTypes.CLOTHING, Items.LEATHER_CHESTPLATE.delegate).setModelTexture(Resources.LEATHER_BODY_PIECE)); - public static final RegistryObject LEATHER_BOOTS = register("leather_boots", () -> new LeatherArmourAccessory(ModAccessoryTypes.FEET, Items.LEATHER_BOOTS.delegate).setModelTexture(Resources.LEATHER_BOOTS)); +// public static final RegistryObject LEATHER_BOOTS = register("leather_boots", () -> new LeatherArmourAccessory(ModAccessoryTypes.FEET, Items.LEATHER_BOOTS.delegate).setModelTexture(Resources.LEATHER_BOOTS)); - private static RegistryObject registerHelmet(final String name, final Supplier itemIn, ResourceLocation modelLocation) { - return ACCESSORIES.register(name, () -> new Helmet(itemIn).setModelTexture(modelLocation)); - } +// private static RegistryObject registerHelmet(final String name, final Supplier itemIn, ResourceLocation modelLocation) { +// return ACCESSORIES.register(name, () -> new Helmet(itemIn).setModelTexture(modelLocation)); +// } private static RegistryObject registerBoots(final String name, final Supplier itemIn, ResourceLocation modelLocation) { return ACCESSORIES.register(name, () -> new ArmourAccessory(ModAccessoryTypes.FEET, itemIn).setModelTexture(modelLocation)); diff --git a/src/main/java/com/sweetrpg/catherder/common/registry/ModItems.java b/src/main/java/com/sweetrpg/catherder/common/registry/ModItems.java index 979fb83b..1df5250b 100644 --- a/src/main/java/com/sweetrpg/catherder/common/registry/ModItems.java +++ b/src/main/java/com/sweetrpg/catherder/common/registry/ModItems.java @@ -3,7 +3,7 @@ import com.sweetrpg.catherder.api.CatHerderAPI; import com.sweetrpg.catherder.api.feature.CatLevel; import com.sweetrpg.catherder.api.registry.Accessory; -import com.sweetrpg.catherder.common.FoodValues; +import com.sweetrpg.catherder.common.lib.FoodValues; import com.sweetrpg.catherder.common.entity.accessory.DyeableAccessory; import com.sweetrpg.catherder.common.item.*; import com.sweetrpg.catherder.common.util.Util; diff --git a/src/main/java/com/sweetrpg/catherder/common/world/WildCropGeneration.java b/src/main/java/com/sweetrpg/catherder/common/world/gen/WildCropGeneration.java similarity index 99% rename from src/main/java/com/sweetrpg/catherder/common/world/WildCropGeneration.java rename to src/main/java/com/sweetrpg/catherder/common/world/gen/WildCropGeneration.java index 1fc7e6dd..e380426f 100644 --- a/src/main/java/com/sweetrpg/catherder/common/world/WildCropGeneration.java +++ b/src/main/java/com/sweetrpg/catherder/common/world/gen/WildCropGeneration.java @@ -1,4 +1,4 @@ -package com.sweetrpg.catherder.common.world; +package com.sweetrpg.catherder.common.world.gen; import com.sweetrpg.catherder.common.config.ConfigHandler; import com.sweetrpg.catherder.common.registry.ModBlocks;