diff --git a/src/client/java/world/vanillyn/BangbooClient.java b/src/client/java/world/vanillyn/BangbooClient.java index 88807d6..c228c44 100644 --- a/src/client/java/world/vanillyn/BangbooClient.java +++ b/src/client/java/world/vanillyn/BangbooClient.java @@ -7,16 +7,15 @@ import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.event.player.UseEntityCallback; -import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; import net.minecraft.client.option.KeyBinding; import net.minecraft.client.render.entity.model.EntityModelLayer; import net.minecraft.client.util.InputUtil; import net.minecraft.util.ActionResult; import org.lwjgl.glfw.GLFW; import world.vanillyn.entity.bangboo.*; -import world.vanillyn.render.Model.Bangboo.BangbooModel; -import world.vanillyn.render.Renderer.BangbooRenderer; -import world.vanillyn.render.Screen.Entity.Handler; +import world.vanillyn.render.model.BangbooModel; +import world.vanillyn.render.render.BangbooRenderer; +import world.vanillyn.render.screen.entity.Handler; @Environment(EnvType.CLIENT) @@ -30,45 +29,26 @@ public void onInitializeClient() { EntityModelLayerRegistry.registerModelLayer(MODEL_BANGBOO_LAYER, BangbooModel::getTexturedModelData); EntityRendererRegistry.register(BangbooType.EOUS.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.EOUS.entityType(), Eous.createMobAttributes()); EntityRendererRegistry.register(BangbooType.BAGBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.BAGBOO.entityType(), Bagboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.SHARKBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.SHARKBOO.entityType(), Sharkboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.EXPLOREBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.EXPLOREBOO.entityType(), Exploreboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.AMILLION.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.AMILLION.entityType(), Amillion.createMobAttributes()); EntityRendererRegistry.register(BangbooType.MAGNETIBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.MAGNETIBOO.entityType(), Magnetiboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.LUCKYBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.LUCKYBOO.entityType(), Luckyboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.BUTLER.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.BUTLER.entityType(), Butler.createMobAttributes()); EntityRendererRegistry.register(BangbooType.SAFETY.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.SAFETY.entityType(), Safety.createMobAttributes()); EntityRendererRegistry.register(BangbooType.OFFICER_CUI.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.OFFICER_CUI.entityType(), OfficerCui.createMobAttributes()); EntityRendererRegistry.register(BangbooType.AVOCABOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.AVOCABOO.entityType(), Avocaboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.CRYBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.CRYBOO.entityType(), Cryboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.BOOLLSEYE.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.BOOLLSEYE.entityType(), Boollseye.createMobAttributes()); EntityRendererRegistry.register(BangbooType.DEVILBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.DEVILBOO.entityType(), Devilboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.ELECTROBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.ELECTROBOO.entityType(), Electroboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.PAPERBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.PAPERBOO.entityType(), Paperboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.PENGUINBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.PENGUINBOO.entityType(), Penguinboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.PLUGBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.PLUGBOO.entityType(), Plugboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.SUMOBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.SUMOBOO.entityType(), Sumoboo.createMobAttributes()); EntityRendererRegistry.register(BangbooType.BADDIEBOO.entityType(), BangbooRenderer::new); - FabricDefaultAttributeRegistry.register(BangbooType.BADDIEBOO.entityType(), Baddieboo.createMobAttributes()); + EntityRendererRegistry.register(BangbooType.BLANKBOO.entityType(), BangbooRenderer::new); KeyBinding openMenu = KeyBindingHelper.registerKeyBinding(new KeyBinding( "key.Bangboo.openscreen", @@ -79,7 +59,7 @@ public void onInitializeClient() { UseEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> { if (world.isClient) { - Handler.handleEntityInteraction(player, (Bangboo) entity); + Handler.handleEntityInteraction(player, entity); } return ActionResult.PASS; }); diff --git a/src/client/java/world/vanillyn/render/Screen/Bangboo/FixBangboo.java b/src/client/java/world/vanillyn/render/Screen/Bangboo/FixBangboo.java deleted file mode 100644 index d6c603e..0000000 --- a/src/client/java/world/vanillyn/render/Screen/Bangboo/FixBangboo.java +++ /dev/null @@ -1,4 +0,0 @@ -package world.vanillyn.render.Screen.Bangboo; - -public class FixBangboo { -} diff --git a/src/client/java/world/vanillyn/render/Screen/Bangboo/WishBangboo.java b/src/client/java/world/vanillyn/render/Screen/Bangboo/WishBangboo.java deleted file mode 100644 index ffded9c..0000000 --- a/src/client/java/world/vanillyn/render/Screen/Bangboo/WishBangboo.java +++ /dev/null @@ -1,4 +0,0 @@ -package world.vanillyn.render.Screen.Bangboo; - -public class WishBangboo { -} diff --git a/src/client/java/world/vanillyn/render/Model/Bangboo/BangbooModel.java b/src/client/java/world/vanillyn/render/model/BangbooModel.java similarity index 98% rename from src/client/java/world/vanillyn/render/Model/Bangboo/BangbooModel.java rename to src/client/java/world/vanillyn/render/model/BangbooModel.java index d0a5b78..f078536 100644 --- a/src/client/java/world/vanillyn/render/Model/Bangboo/BangbooModel.java +++ b/src/client/java/world/vanillyn/render/model/BangbooModel.java @@ -1,4 +1,4 @@ -package world.vanillyn.render.Model.Bangboo; +package world.vanillyn.render.model; import net.minecraft.client.model.*; import net.minecraft.client.render.VertexConsumer; diff --git a/src/client/java/world/vanillyn/render/Renderer/BangbooRenderer.java b/src/client/java/world/vanillyn/render/render/BangbooRenderer.java similarity index 86% rename from src/client/java/world/vanillyn/render/Renderer/BangbooRenderer.java rename to src/client/java/world/vanillyn/render/render/BangbooRenderer.java index ae0f58a..b8e1e58 100644 --- a/src/client/java/world/vanillyn/render/Renderer/BangbooRenderer.java +++ b/src/client/java/world/vanillyn/render/render/BangbooRenderer.java @@ -1,11 +1,11 @@ -package world.vanillyn.render.Renderer; +package world.vanillyn.render.render; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.util.Identifier; import world.vanillyn.BangbooClient; import world.vanillyn.entity.bangboo.Bangboo; -import world.vanillyn.render.Model.Bangboo.BangbooModel; +import world.vanillyn.render.model.BangbooModel; public class BangbooRenderer extends MobEntityRenderer { diff --git a/src/client/java/world/vanillyn/render/Screen/TestScreen.java b/src/client/java/world/vanillyn/render/screen/TestScreen.java similarity index 97% rename from src/client/java/world/vanillyn/render/Screen/TestScreen.java rename to src/client/java/world/vanillyn/render/screen/TestScreen.java index 681baa4..56d1a44 100644 --- a/src/client/java/world/vanillyn/render/Screen/TestScreen.java +++ b/src/client/java/world/vanillyn/render/screen/TestScreen.java @@ -1,4 +1,4 @@ -package world.vanillyn.render.Screen; +package world.vanillyn.render.screen; import io.wispforest.owo.ui.base.BaseUIModelScreen; import io.wispforest.owo.ui.component.ButtonComponent; diff --git a/src/client/java/world/vanillyn/render/screen/bangboo/FixBangboo.java b/src/client/java/world/vanillyn/render/screen/bangboo/FixBangboo.java new file mode 100644 index 0000000..77a5511 --- /dev/null +++ b/src/client/java/world/vanillyn/render/screen/bangboo/FixBangboo.java @@ -0,0 +1,4 @@ +package world.vanillyn.render.screen.bangboo; + +public class FixBangboo { +} diff --git a/src/client/java/world/vanillyn/render/Screen/Bangboo/ManageBangboo.java b/src/client/java/world/vanillyn/render/screen/bangboo/ManageBangboo.java similarity index 93% rename from src/client/java/world/vanillyn/render/Screen/Bangboo/ManageBangboo.java rename to src/client/java/world/vanillyn/render/screen/bangboo/ManageBangboo.java index 9d4f1b7..e0aad3d 100644 --- a/src/client/java/world/vanillyn/render/Screen/Bangboo/ManageBangboo.java +++ b/src/client/java/world/vanillyn/render/screen/bangboo/ManageBangboo.java @@ -1,4 +1,4 @@ -package world.vanillyn.render.Screen.Bangboo; +package world.vanillyn.render.screen.bangboo; import io.wispforest.owo.ui.base.BaseUIModelScreen; import io.wispforest.owo.ui.component.ButtonComponent; diff --git a/src/client/java/world/vanillyn/render/screen/bangboo/WishBangboo.java b/src/client/java/world/vanillyn/render/screen/bangboo/WishBangboo.java new file mode 100644 index 0000000..6971ec9 --- /dev/null +++ b/src/client/java/world/vanillyn/render/screen/bangboo/WishBangboo.java @@ -0,0 +1,4 @@ +package world.vanillyn.render.screen.bangboo; + +public class WishBangboo { +} diff --git a/src/client/java/world/vanillyn/render/Screen/Entity/Handler.java b/src/client/java/world/vanillyn/render/screen/entity/Handler.java similarity index 51% rename from src/client/java/world/vanillyn/render/Screen/Entity/Handler.java rename to src/client/java/world/vanillyn/render/screen/entity/Handler.java index 9394e03..7d04cb7 100644 --- a/src/client/java/world/vanillyn/render/Screen/Entity/Handler.java +++ b/src/client/java/world/vanillyn/render/screen/entity/Handler.java @@ -1,19 +1,20 @@ -package world.vanillyn.render.Screen.Entity; +package world.vanillyn.render.screen.entity; import net.minecraft.client.MinecraftClient; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import world.vanillyn.BangbooMod; import world.vanillyn.entity.bangboo.Bangboo; -import world.vanillyn.render.Screen.TestScreen; +import world.vanillyn.render.screen.TestScreen; public class Handler { - public static void handleEntityInteraction(PlayerEntity player, Bangboo entity) { - if (player.isSneaking() && entity instanceof Bangboo) { + // previously, if the entity wasn't Bangboo, it'd throw a cast exception in the usage of this method + // fixed so that you don't run into that -- Aurora + public static void handleEntityInteraction(PlayerEntity player, Entity entity) { + if (player.isSneaking() && entity instanceof Bangboo bangboo) { //lazy example of me sending data over. not pretty but it works! - MinecraftClient.getInstance().setScreen(new TestScreen(entity, player)); - } else if(player.isSneaking()) { - BangbooMod.LOGGER.warn("Interacted entity is not Bangboo"); + MinecraftClient.getInstance().setScreen(new TestScreen(bangboo, player)); } } } diff --git a/src/main/java/world/vanillyn/entity/bangboo/BangbooType.java b/src/main/java/world/vanillyn/entity/bangboo/BangbooType.java index 1065989..a2135db 100644 --- a/src/main/java/world/vanillyn/entity/bangboo/BangbooType.java +++ b/src/main/java/world/vanillyn/entity/bangboo/BangbooType.java @@ -1,8 +1,10 @@ package world.vanillyn.entity.bangboo; import com.mojang.serialization.Lifecycle; +import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnGroup; +import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; @@ -15,30 +17,30 @@ public record BangbooType(EntityType entityType, BangbooCo public static final RegistryKey> REGISTRY_KEY = RegistryKey.ofRegistry(BangbooMod.id("bangboo")); public static final Registry REGISTRY = new SimpleRegistry<>(REGISTRY_KEY, Lifecycle.stable()); - public static final BangbooType AMILLION = register("amillion", Amillion::new, 's'); - public static final BangbooType AVOCABOO = register("avocaboo", Avocaboo::new, 's'); - public static final BangbooType BADDIEBOO = register("baddieboo", Baddieboo::new, 's'); - public static final BangbooType BAGBOO = register("bagboo", Bagboo::new, 's'); - public static final BangbooType BOOLLSEYE = register("boollseye", Boollseye::new, 's'); - public static final BangbooType BUTLER = register("butler", Butler::new, 's'); - public static final BangbooType CRYBOO = register("cryboo", Cryboo::new, 's'); - public static final BangbooType DEVILBOO = register("devilboo", Devilboo::new, 's'); - public static final BangbooType ELECTROBOO = register("electroboo", Electroboo::new, 's'); - public static final BangbooType EOUS = register("eous", Eous::new, 's'); - public static final BangbooType EXPLOREBOO = register("exploreboo", Exploreboo::new, 's'); - public static final BangbooType LUCKYBOO = register("luckyboo", Luckyboo::new, 's'); - public static final BangbooType MAGNETIBOO = register("magnetiboo", Magnetiboo::new, 's'); - public static final BangbooType OFFICER_CUI = register("officer_cui", OfficerCui::new, 's'); - public static final BangbooType PAPERBOO = register("paperboo", Paperboo::new, 's'); - public static final BangbooType PENGUINBOO = register("penguinboo", Penguinboo::new, 's'); - public static final BangbooType PLUGBOO = register("plugboo", Plugboo::new, 's'); - public static final BangbooType SAFETY = register("safety", Safety::new, 's'); - public static final BangbooType SUMOBOO = register("sumoboo", Sumoboo::new, 's'); - public static final BangbooType SHARKBOO = register("sharkboo", Sharkboo::new, 's'); + public static final BangbooType AMILLION = register("amillion", Amillion::new, Amillion.createMobAttributes(), 's'); + public static final BangbooType AVOCABOO = register("avocaboo", Avocaboo::new, Avocaboo.createMobAttributes(), 's'); + public static final BangbooType BADDIEBOO = register("baddieboo", Baddieboo::new, Baddieboo.createMobAttributes(), 's'); + public static final BangbooType BAGBOO = register("bagboo", Bagboo::new, Bagboo.createMobAttributes(), 's'); + public static final BangbooType BOOLLSEYE = register("boollseye", Boollseye::new, Boollseye.createMobAttributes(), 's'); + public static final BangbooType BUTLER = register("butler", Butler::new, Butler.createMobAttributes(), 's'); + public static final BangbooType CRYBOO = register("cryboo", Cryboo::new, Cryboo.createMobAttributes(), 's'); + public static final BangbooType DEVILBOO = register("devilboo", Devilboo::new, Devilboo.createMobAttributes(), 's'); + public static final BangbooType ELECTROBOO = register("electroboo", Electroboo::new, Electroboo.createMobAttributes(), 's'); + public static final BangbooType EOUS = register("eous", Eous::new, Eous.createMobAttributes(), 's'); + public static final BangbooType EXPLOREBOO = register("exploreboo", Exploreboo::new, Exploreboo.createMobAttributes(), 's'); + public static final BangbooType LUCKYBOO = register("luckyboo", Luckyboo::new, Luckyboo.createMobAttributes(), 's'); + public static final BangbooType MAGNETIBOO = register("magnetiboo", Magnetiboo::new, Magnetiboo.createMobAttributes(), 's'); + public static final BangbooType OFFICER_CUI = register("officer_cui", OfficerCui::new, OfficerCui.createMobAttributes(), 's'); + public static final BangbooType PAPERBOO = register("paperboo", Paperboo::new, Paperboo.createMobAttributes(), 's'); + public static final BangbooType PENGUINBOO = register("penguinboo", Penguinboo::new, Penguinboo.createMobAttributes(), 's'); + public static final BangbooType PLUGBOO = register("plugboo", Plugboo::new, Plugboo.createMobAttributes(), 's'); + public static final BangbooType SAFETY = register("safety", Safety::new, Safety.createMobAttributes(), 's'); + public static final BangbooType SUMOBOO = register("sumoboo", Sumoboo::new, Sumoboo.createMobAttributes(), 's'); + public static final BangbooType SHARKBOO = register("sharkboo", Sharkboo::new, Sharkboo.createMobAttributes(), 's'); - public static final BangbooType BLANKBOO = register("blankboo", Blankboo::new, 's'); + public static final BangbooType BLANKBOO = register("blankboo", Blankboo::new, Blankboo.createMobAttributes(), 's'); - public static BangbooType register(String name, EntityType.EntityFactory bangbooFactory, char rating) { + public static BangbooType register(String name, EntityType.EntityFactory bangbooFactory, DefaultAttributeContainer.Builder defaultAttributesBuilder, char rating) { var entityType = Registry.register(Registries.ENTITY_TYPE, BangbooMod.id("bangboo_" + name), EntityType.Builder.create(bangbooFactory, SpawnGroup.MISC) @@ -48,6 +50,7 @@ public static BangbooType register(String name, EntityTyp BangbooMod.id("bangboo_core_" + name), new BangbooCore<>(entityType, rating)); + FabricDefaultAttributeRegistry.register(entityType, defaultAttributesBuilder); return Registry.register(REGISTRY, BangbooMod.id(name), new BangbooType<>(entityType,