From 6af94cd80142c9db6e5c970eb3c91677d0026a92 Mon Sep 17 00:00:00 2001 From: Arbee <45911516+Arbee4ever@users.noreply.github.com> Date: Mon, 9 May 2022 01:06:44 +0200 Subject: [PATCH] Revert "First try to organize this repo more and implementation of #3" --- src/main/java/net/arbee/addola/Addola.java | 32 +++-- .../java/net/arbee/addola/AddolaClient.java | 72 ++++-------- .../client/render/BoatItemRenderer.java | 29 ----- .../client/render/ChestBoatItemRenderer.java | 29 ----- .../addola/entity/ai/goal/EmeraldGoal.java | 4 +- .../renderer}/ChestBoatEntityRenderer.java | 27 +++-- .../entity/vehicle/ChestBoatEntity.java | 68 +++-------- .../net/arbee/addola/item/ChestBoatItem.java | 8 +- .../net/arbee/addola/mixins/BerryMixin.java | 4 +- .../arbee/addola/mixins/BoatEntityMixin.java | 35 ------ .../addola/mixins/EntityRendererMixin.java | 28 ----- .../mixins/LivingEntityRendererMixin.java | 34 ------ .../arbee/addola/mixins/ServerWorldMixin.java | 6 +- .../SpawnChestBoatEntityPacketSender.java | 111 +++--------------- .../addola/registries/AddolaEntities.java | 21 ---- .../arbee/addola/registries/AddolaItems.java | 45 ------- .../{AddolaCommands.java => Commands.java} | 2 +- .../{AddolaGamerules.java => Gamerules.java} | 2 +- src/main/resources/addola.mixins.json | 3 - .../resources/assets/addola/lang/en_us.json | 8 +- .../addola/models/item/acacia_chestboat.json | 28 ----- .../addola/models/item/birch_chestboat.json | 28 ----- .../models/item/dark_oak_chestboat.json | 28 ----- .../addola/models/item/jungle_chestboat.json | 28 ----- .../addola/models/item/oak_chestboat.json | 28 ----- .../addola/models/item/spruce_chestboat.json | 28 ----- .../minecraft/models/item/acacia_boat.json | 28 ----- .../minecraft/models/item/birch_boat.json | 28 ----- .../minecraft/models/item/dark_oak_boat.json | 28 ----- .../minecraft/models/item/jungle_boat.json | 28 ----- .../minecraft/models/item/oak_boat.json | 28 ----- .../minecraft/models/item/spruce_boat.json | 28 ----- .../tags/blocks/blocks_with_inventories.json | 10 -- 33 files changed, 109 insertions(+), 805 deletions(-) delete mode 100644 src/main/java/net/arbee/addola/client/render/BoatItemRenderer.java delete mode 100644 src/main/java/net/arbee/addola/client/render/ChestBoatItemRenderer.java rename src/main/java/net/arbee/addola/{client/render => entity/renderer}/ChestBoatEntityRenderer.java (83%) delete mode 100644 src/main/java/net/arbee/addola/mixins/BoatEntityMixin.java delete mode 100644 src/main/java/net/arbee/addola/mixins/EntityRendererMixin.java delete mode 100644 src/main/java/net/arbee/addola/mixins/LivingEntityRendererMixin.java delete mode 100644 src/main/java/net/arbee/addola/registries/AddolaEntities.java delete mode 100644 src/main/java/net/arbee/addola/registries/AddolaItems.java rename src/main/java/net/arbee/addola/registries/{AddolaCommands.java => Commands.java} (92%) rename src/main/java/net/arbee/addola/registries/{AddolaGamerules.java => Gamerules.java} (97%) delete mode 100644 src/main/resources/assets/addola/models/item/acacia_chestboat.json delete mode 100644 src/main/resources/assets/addola/models/item/birch_chestboat.json delete mode 100644 src/main/resources/assets/addola/models/item/dark_oak_chestboat.json delete mode 100644 src/main/resources/assets/addola/models/item/jungle_chestboat.json delete mode 100644 src/main/resources/assets/addola/models/item/oak_chestboat.json delete mode 100644 src/main/resources/assets/addola/models/item/spruce_chestboat.json delete mode 100644 src/main/resources/assets/minecraft/models/item/acacia_boat.json delete mode 100644 src/main/resources/assets/minecraft/models/item/birch_boat.json delete mode 100644 src/main/resources/assets/minecraft/models/item/dark_oak_boat.json delete mode 100644 src/main/resources/assets/minecraft/models/item/jungle_boat.json delete mode 100644 src/main/resources/assets/minecraft/models/item/oak_boat.json delete mode 100644 src/main/resources/assets/minecraft/models/item/spruce_boat.json delete mode 100644 src/main/resources/data/addola/tags/blocks/blocks_with_inventories.json diff --git a/src/main/java/net/arbee/addola/Addola.java b/src/main/java/net/arbee/addola/Addola.java index f32b7af..287593f 100644 --- a/src/main/java/net/arbee/addola/Addola.java +++ b/src/main/java/net/arbee/addola/Addola.java @@ -1,19 +1,35 @@ package net.arbee.addola; -import net.arbee.addola.registries.AddolaCommands; -import net.arbee.addola.registries.AddolaEntities; -import net.arbee.addola.registries.AddolaGamerules; -import net.arbee.addola.registries.AddolaItems; +import net.arbee.addola.entity.vehicle.ChestBoatEntity; +import net.arbee.addola.item.ChestBoatItem; +import net.arbee.addola.registries.Commands; +import net.arbee.addola.registries.Gamerules; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; +import net.minecraft.entity.EntityDimensions; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.SpawnGroup; +import net.minecraft.entity.vehicle.BoatEntity; +import net.minecraft.item.ItemGroup; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; public class Addola implements ModInitializer { public static final String MOD_NAME = "Addola"; + public static final ChestBoatItem CHESTBOAT_ITEM = new ChestBoatItem(BoatEntity.Type.OAK, new FabricItemSettings().group(ItemGroup.TRANSPORTATION)); + + public static final EntityType CHESTBOAT = Registry.register( + Registry.ENTITY_TYPE, + new Identifier("addola", "chestboat"), + FabricEntityTypeBuilder.create(SpawnGroup.MISC, ChestBoatEntity::new).dimensions(EntityDimensions.fixed(1.375f, 0.5625f)).build() + ); + @Override public void onInitialize() { - AddolaGamerules.setupGamerules(); - AddolaCommands.setupCommands(); - AddolaEntities.setupEntities(); - AddolaItems.setupItems(); + Registry.register(Registry.ITEM, new Identifier("addola", "chestboat"), CHESTBOAT_ITEM); + Gamerules.setupGamerules(); + Commands.setupCommands(); } } \ No newline at end of file diff --git a/src/main/java/net/arbee/addola/AddolaClient.java b/src/main/java/net/arbee/addola/AddolaClient.java index ffb82c8..c097494 100644 --- a/src/main/java/net/arbee/addola/AddolaClient.java +++ b/src/main/java/net/arbee/addola/AddolaClient.java @@ -1,33 +1,13 @@ package net.arbee.addola; -import io.netty.buffer.Unpooled; -import net.arbee.addola.client.render.BoatItemRenderer; -import net.arbee.addola.client.render.ChestBoatEntityRenderer; -import net.arbee.addola.client.render.ChestBoatItemRenderer; +import net.arbee.addola.entity.renderer.ChestBoatEntityRenderer; import net.arbee.addola.entity.vehicle.ChestBoatEntity; import net.arbee.addola.network.SpawnChestBoatEntityPacketSender; -import net.arbee.addola.registries.AddolaEntities; -import net.arbee.addola.registries.AddolaItems; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; -import net.fabricmc.fabric.api.network.ClientSidePacketRegistry; -import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; -import net.minecraft.MinecraftVersion; -import net.minecraft.client.MinecraftClient; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.item.BoatItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; import java.util.UUID; @@ -36,35 +16,27 @@ public class AddolaClient implements ClientModInitializer { @Override public void onInitializeClient() { - AddolaItems.setupItemRenderers(); - - EntityRendererRegistry.INSTANCE.register(AddolaEntities.CHESTBOAT, (dispatcher, context) -> new ChestBoatEntityRenderer(dispatcher)); - - receiveEntityPacket(); - } - - public void receiveEntityPacket() { - ClientSidePacketRegistry.INSTANCE.register(SpawnChestBoatEntityPacketSender.IDENTIFIER, (ctx, byteBuf) -> { - EntityType et = Registry.ENTITY_TYPE.get(byteBuf.readVarInt()); - UUID uuid = byteBuf.readUuid(); - int entityId = byteBuf.readVarInt(); - Vec3d pos = SpawnChestBoatEntityPacketSender.PacketBufUtil.readVec3d(byteBuf); - float pitch = SpawnChestBoatEntityPacketSender.PacketBufUtil.readAngle(byteBuf); - float yaw = SpawnChestBoatEntityPacketSender.PacketBufUtil.readAngle(byteBuf); - ctx.getTaskQueue().execute(() -> { - if (MinecraftClient.getInstance().world == null) - throw new IllegalStateException("Tried to spawn entity in a null world!"); - Entity e = et.create(MinecraftClient.getInstance().world); - if (e == null) - throw new IllegalStateException("Failed to create instance of entity \"" + Registry.ENTITY_TYPE.getId(et) + "\"!"); - e.updateTrackedPosition(pos); - e.setPos(pos.x, pos.y, pos.z); - e.pitch = pitch; - e.yaw = yaw; - e.setEntityId(entityId); - e.setUuid(uuid); - MinecraftClient.getInstance().world.addEntity(entityId, e); - }); + ClientPlayNetworking.registerGlobalReceiver(SpawnChestBoatEntityPacketSender.IDENTIFIER, (client, handler, buf, responseSender) -> { + final int entityId = buf.readInt(); + final UUID uuid = buf.readUuid(); + final double x = buf.readDouble(); + final double y = buf.readDouble(); + final double z = buf.readDouble(); + final double xVelocity = buf.readDouble(); + final double yVelocity = buf.readDouble(); + final double zVelocity = buf.readDouble(); + final float pitch = buf.readFloat(); + final float yaw = buf.readFloat(); + final ChestBoatEntity boat = new ChestBoatEntity(Addola.CHESTBOAT, client.world); + boat.setEntityId(entityId); + boat.setUuid(uuid); + boat.setPos(x, y, z); + boat.setVelocity(xVelocity, yVelocity, zVelocity); + boat.setYaw(yaw); + boat.pitch = pitch; + client.execute(() -> client.world.addEntity(entityId, boat)); }); + + EntityRendererRegistry.INSTANCE.register(Addola.CHESTBOAT, (dispatcher, context) -> new ChestBoatEntityRenderer(dispatcher)); } } diff --git a/src/main/java/net/arbee/addola/client/render/BoatItemRenderer.java b/src/main/java/net/arbee/addola/client/render/BoatItemRenderer.java deleted file mode 100644 index fa24591..0000000 --- a/src/main/java/net/arbee/addola/client/render/BoatItemRenderer.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.arbee.addola.client.render; - -import net.arbee.addola.mixins.BoatItemAccess; -import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.model.json.ModelTransformation.Mode; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.vehicle.BoatEntity; -import net.minecraft.item.ItemStack; - - -public class BoatItemRenderer implements BuiltinItemRendererRegistry.DynamicItemRenderer { - public static BoatEntity DUMMY; - - @Override - public void render(ItemStack stack, Mode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { - if ((DUMMY == null && MinecraftClient.getInstance().world != null) || MinecraftClient.getInstance().world != DUMMY.world) { - DUMMY = new BoatEntity(EntityType.BOAT, MinecraftClient.getInstance().world); - } - DUMMY.setBoatType(((BoatItemAccess)stack.getItem()).getType()); - EntityRenderer renderer = MinecraftClient.getInstance().getEntityRenderDispatcher().getRenderer(DUMMY); - matrices.translate(0.5, 0, 0.5); - renderer.render(DUMMY, DUMMY.getYaw(10), 0, matrices, vertexConsumers, light); - } - -} diff --git a/src/main/java/net/arbee/addola/client/render/ChestBoatItemRenderer.java b/src/main/java/net/arbee/addola/client/render/ChestBoatItemRenderer.java deleted file mode 100644 index c03a893..0000000 --- a/src/main/java/net/arbee/addola/client/render/ChestBoatItemRenderer.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.arbee.addola.client.render; - -import net.arbee.addola.Addola; -import net.arbee.addola.entity.vehicle.ChestBoatEntity; -import net.arbee.addola.item.ChestBoatItem; -import net.arbee.addola.registries.AddolaEntities; -import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.model.json.ModelTransformation.Mode; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; - -public class ChestBoatItemRenderer implements BuiltinItemRendererRegistry.DynamicItemRenderer { - public static ChestBoatEntity DUMMY; - - @Override - public void render(ItemStack stack, Mode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { - if ((DUMMY == null && MinecraftClient.getInstance().world != null) || MinecraftClient.getInstance().world != DUMMY.world) { - DUMMY = new ChestBoatEntity(AddolaEntities.CHESTBOAT, MinecraftClient.getInstance().world); - } - DUMMY.setBoatType(((ChestBoatItem)stack.getItem()).getBoatType()); - EntityRenderer renderer = MinecraftClient.getInstance().getEntityRenderDispatcher().getRenderer(DUMMY); - matrices.translate(0.5, 0, 0.5); - renderer.render(DUMMY, DUMMY.getYaw(10), 0, matrices, vertexConsumers, light); - } - -} diff --git a/src/main/java/net/arbee/addola/entity/ai/goal/EmeraldGoal.java b/src/main/java/net/arbee/addola/entity/ai/goal/EmeraldGoal.java index 175f205..e14de17 100644 --- a/src/main/java/net/arbee/addola/entity/ai/goal/EmeraldGoal.java +++ b/src/main/java/net/arbee/addola/entity/ai/goal/EmeraldGoal.java @@ -1,6 +1,6 @@ package net.arbee.addola.entity.ai.goal; -import net.arbee.addola.registries.AddolaGamerules; +import net.arbee.addola.registries.Gamerules; import net.minecraft.entity.ai.TargetPredicate; import net.minecraft.entity.ai.goal.TemptGoal; import net.minecraft.entity.mob.PathAwareEntity; @@ -16,7 +16,7 @@ public EmeraldGoal(PathAwareEntity mob, double speed, Ingredient food, boolean c @Override public boolean canStart() { - if (this.mob.world.getGameRules().getBoolean(AddolaGamerules.VILLAGERS_FOLLOW)) { + if (this.mob.world.getGameRules().getBoolean(Gamerules.VILLAGERS_FOLLOW)) { if (this.cooldown > 0) { --this.cooldown; return false; diff --git a/src/main/java/net/arbee/addola/client/render/ChestBoatEntityRenderer.java b/src/main/java/net/arbee/addola/entity/renderer/ChestBoatEntityRenderer.java similarity index 83% rename from src/main/java/net/arbee/addola/client/render/ChestBoatEntityRenderer.java rename to src/main/java/net/arbee/addola/entity/renderer/ChestBoatEntityRenderer.java index 6e3b356..f190529 100644 --- a/src/main/java/net/arbee/addola/client/render/ChestBoatEntityRenderer.java +++ b/src/main/java/net/arbee/addola/entity/renderer/ChestBoatEntityRenderer.java @@ -1,7 +1,8 @@ -package net.arbee.addola.client.render; +package net.arbee.addola.entity.renderer; import net.arbee.addola.entity.vehicle.ChestBoatEntity; -import net.minecraft.block.BlockState; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.RenderLayer; @@ -12,10 +13,13 @@ import net.minecraft.client.render.entity.model.BoatEntityModel; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.Vector3f; +import net.minecraft.entity.vehicle.BoatEntity; +import net.minecraft.nbt.CompoundTag; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Quaternion; -import net.minecraft.util.registry.Registry; + +import java.rmi.registry.Registry; public class ChestBoatEntityRenderer extends EntityRenderer { protected final BoatEntityModel model = new BoatEntityModel(); @@ -54,12 +58,10 @@ public void render(ChestBoatEntity chestBoatEntity, float f, float g, MatrixStac VertexConsumer vertexConsumer2 = vertexConsumerProvider.getBuffer(RenderLayer.getWaterMask()); this.model.getBottom().render(matrixStack, vertexConsumer2, i, OverlayTexture.DEFAULT_UV); } - matrixStack.scale(-0.8F, -0.8F, 0.8F); - matrixStack.translate(-0.0D, -0.05D, -0.5D); - - BlockState blockEntity = Registry.BLOCK.get(new Identifier(chestBoatEntity.getBlockEntity())).getDefaultState(); + matrixStack.scale(-0.9F, -0.9F, 0.9F); + matrixStack.translate(-0.1D, -0.15D, -0.5D); - MinecraftClient.getInstance().getBlockRenderManager().renderBlockAsEntity(blockEntity, matrixStack, vertexConsumerProvider, i, OverlayTexture.DEFAULT_UV); + MinecraftClient.getInstance().getBlockRenderManager().renderBlockAsEntity(Blocks.CHEST.getDefaultState(), matrixStack, vertexConsumerProvider, i, 0); matrixStack.pop(); super.render(chestBoatEntity, f, g, matrixStack, vertexConsumerProvider, i); @@ -69,4 +71,13 @@ public void render(ChestBoatEntity chestBoatEntity, float f, float g, MatrixStac public Identifier getTexture(ChestBoatEntity chestBoatEntity) { return TEXTURES[chestBoatEntity.getBoatType().ordinal()]; } + + protected Block readCustomDataFromTag(CompoundTag tag) { + if (tag.contains("Block", 8)) { + tag.getString("Block"); + return Blocks.CHEST; + } else { + return Blocks.CHEST; + } + } } \ No newline at end of file diff --git a/src/main/java/net/arbee/addola/entity/vehicle/ChestBoatEntity.java b/src/main/java/net/arbee/addola/entity/vehicle/ChestBoatEntity.java index 3970675..8b0443e 100644 --- a/src/main/java/net/arbee/addola/entity/vehicle/ChestBoatEntity.java +++ b/src/main/java/net/arbee/addola/entity/vehicle/ChestBoatEntity.java @@ -3,39 +3,29 @@ import net.arbee.addola.Addola; import net.arbee.addola.mixins.BoatEntityAccess; import net.arbee.addola.network.SpawnChestBoatEntityPacketSender; -import net.arbee.addola.registries.AddolaEntities; -import net.arbee.addola.registries.AddolaItems; -import net.minecraft.block.BarrelBlock; import net.minecraft.block.Block; import net.minecraft.block.Blocks; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; -import net.minecraft.entity.ItemEntity; import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedDataHandlerRegistry; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.vehicle.BoatEntity; -import net.minecraft.inventory.Inventory; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Packet; import net.minecraft.tag.FluidTags; -import net.minecraft.text.LiteralText; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; import net.minecraft.world.World; public class ChestBoatEntity extends BoatEntity { private static final TrackedData BLOCK_ENTITY; + ChestBoatEntity instance = this; + Block block; static { @@ -43,7 +33,7 @@ public class ChestBoatEntity extends BoatEntity { } public ChestBoatEntity(World world, double x, double y, double z) { - super(AddolaEntities.CHESTBOAT, world); + super(Addola.CHESTBOAT, world); updatePosition(x, y, z); setVelocity(Vec3d.ZERO); prevX = x; @@ -51,28 +41,23 @@ public ChestBoatEntity(World world, double x, double y, double z) { prevZ = z; } - public ChestBoatEntity(EntityType entityType, World world) { + public ChestBoatEntity(EntityType entityType, World world) { super(entityType, world); } @Override public ActionResult interact(PlayerEntity player, Hand hand) { - if (((BoatEntityAccess)this).getTicksUnderwater() < 60.0F) { + if (player.shouldCancelInteraction()) { + return ActionResult.PASS; + } else if (((BoatEntityAccess)instance).getTicksUnderwater() < 60.0F) { if (!this.world.isClient) { - Block block = Registry.BLOCK.get(Registry.ITEM.getId(player.getMainHandStack().getItem())); + /*block = Block.getBlockFromItem(player.getMainHandStack().getItem()); + if(block.hasBlockEntity()) { + player.getMainHandStack().decrement(1); + }*/ if (player.isSneaking()) { - if (block.equals(Blocks.AIR)) { - world.spawnEntity(new ItemEntity(world, getX(), getY(), getZ(), new ItemStack(Registry.ITEM.get(new Identifier(getBlockEntity()))))); - BoatEntity boat = new BoatEntity(world, getX(), getY(), getZ()); - world.spawnEntity(boat); - boat.copyPositionAndRotation(this); - remove(); - } else if (block.hasBlockEntity()) { - world.spawnEntity(new ItemEntity(world, getX(), getY(), getZ(), new ItemStack(Registry.ITEM.get(new Identifier(getBlockEntity()))))); - setBlockEntity(Registry.ITEM.getId(player.getMainHandStack().getItem()).toString()); - player.getMainHandStack().decrement(1); - return ActionResult.SUCCESS; - } + new BoatEntity(this.world, this.getX(), this.getY(), this.getZ()); + return ActionResult.SUCCESS; } return player.startRiding(this) ? ActionResult.CONSUME : ActionResult.PASS; } else { @@ -83,19 +68,16 @@ public ActionResult interact(PlayerEntity player, Hand hand) { } } - @Override protected void initDataTracker() { - super.initDataTracker(); - this.dataTracker.startTracking(BLOCK_ENTITY, Registry.BLOCK.getId(Blocks.CHEST).toString()); + this.dataTracker.startTracking(BLOCK_ENTITY, Blocks.CHEST.getName().getString()); } protected void writeCustomDataToTag(CompoundTag tag) { - super.writeCustomDataToTag(tag); + System.out.print(getBlockEntity()); tag.putString("BlockEntity", getBlockEntity()); } protected void readCustomDataFromTag(CompoundTag tag) { - super.readCustomDataFromTag(tag); if (tag.contains("BlockEntity", 8)) { this.setBlockEntity(tag.getString("BlockEntity")); } @@ -121,8 +103,8 @@ public void updatePassengerPosition(Entity passenger) { Vec3d vec3d = (new Vec3d((double)f, 0.0D, 0.0D)).rotateY(-this.yaw * 0.017453292F - 1.5707964F); passenger.updatePosition(this.getX() + vec3d.x, this.getY() + (double)g, this.getZ() + vec3d.z); - passenger.yaw += ((BoatEntityAccess)this).getYawVelocity(); - passenger.setHeadYaw(passenger.getHeadYaw() + ((BoatEntityAccess)this).getYawVelocity()); + passenger.yaw += ((BoatEntityAccess)instance).getYawVelocity(); + passenger.setHeadYaw(passenger.getHeadYaw() + ((BoatEntityAccess)instance).getYawVelocity()); this.copyEntityData(passenger); if (passenger instanceof AnimalEntity && this.getPassengerList().size() > 1) { int j = passenger.getEntityId() % 2 == 0 ? 90 : 270; @@ -134,21 +116,7 @@ public void updatePassengerPosition(Entity passenger) { @Override public Item asItem() { - switch(this.getBoatType()) { - case OAK: - default: - return AddolaItems.OAK_CHESTBOAT_ITEM; - case SPRUCE: - return AddolaItems.SPRUCE_CHESTBOAT_ITEM; - case BIRCH: - return AddolaItems.BIRCH_CHESTBOAT_ITEM; - case JUNGLE: - return AddolaItems.JUNGLE_CHESTBOAT_ITEM; - case ACACIA: - return AddolaItems.ACACIA_CHESTBOAT_ITEM; - case DARK_OAK: - return AddolaItems.DARKOAK_CHESTBOAT_ITEM; - } + return Addola.CHESTBOAT_ITEM; } @Override diff --git a/src/main/java/net/arbee/addola/item/ChestBoatItem.java b/src/main/java/net/arbee/addola/item/ChestBoatItem.java index 48ebb65..1edb15d 100644 --- a/src/main/java/net/arbee/addola/item/ChestBoatItem.java +++ b/src/main/java/net/arbee/addola/item/ChestBoatItem.java @@ -4,7 +4,6 @@ import net.arbee.addola.mixins.BoatItemAccess; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.item.BoatItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -25,7 +24,6 @@ public class ChestBoatItem extends BoatItem { public ChestBoatItem(ChestBoatEntity.Type type, Item.Settings settings) { super(type, settings); - settings.maxCount(1); } @Override @@ -53,6 +51,8 @@ public TypedActionResult use(World world, PlayerEntity user, Hand han if (hitResult.getType() == HitResult.Type.BLOCK) { ChestBoatEntity chestBoatEntity = new ChestBoatEntity(world, hitResult.getPos().x, hitResult.getPos().y, hitResult.getPos().z); + System.out.print(instance + "\n"); + System.out.print(((BoatItemAccess)instance).getType() + "\n"); chestBoatEntity.setBoatType(((BoatItemAccess)instance).getType()); chestBoatEntity.yaw = user.yaw; if (!world.isSpaceEmpty(chestBoatEntity, chestBoatEntity.getBoundingBox().expand(-0.1D))) { @@ -73,8 +73,4 @@ public TypedActionResult use(World world, PlayerEntity user, Hand han } } } - - public BoatEntity.Type getBoatType() { - return ((BoatItemAccess)instance).getType(); - } } diff --git a/src/main/java/net/arbee/addola/mixins/BerryMixin.java b/src/main/java/net/arbee/addola/mixins/BerryMixin.java index 1a895f7..c0f888a 100644 --- a/src/main/java/net/arbee/addola/mixins/BerryMixin.java +++ b/src/main/java/net/arbee/addola/mixins/BerryMixin.java @@ -1,6 +1,6 @@ package net.arbee.addola.mixins; -import net.arbee.addola.registries.AddolaGamerules; +import net.arbee.addola.registries.Gamerules; import net.minecraft.block.SweetBerryBushBlock; import net.minecraft.entity.Entity; import net.minecraft.entity.damage.DamageSource; @@ -12,7 +12,7 @@ public class BerryMixin{ @Redirect(method = "onEntityCollision", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;damage(Lnet/minecraft/entity/damage/DamageSource;F)Z")) public boolean collision (Entity entity, DamageSource source, float f) { - if(entity.isInSneakingPose() && !entity.getEntityWorld().getGameRules().getBoolean(AddolaGamerules.BERRYBUSH_SNEAK_DAMAGE)) { + if(entity.isInSneakingPose() && !entity.getEntityWorld().getGameRules().getBoolean(Gamerules.BERRYBUSH_SNEAK_DAMAGE)) { entity.damage(source, 0); } else { entity.damage(source, f); diff --git a/src/main/java/net/arbee/addola/mixins/BoatEntityMixin.java b/src/main/java/net/arbee/addola/mixins/BoatEntityMixin.java deleted file mode 100644 index fc5f12c..0000000 --- a/src/main/java/net/arbee/addola/mixins/BoatEntityMixin.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.arbee.addola.mixins; - -import net.arbee.addola.entity.vehicle.ChestBoatEntity; -import net.minecraft.block.Block; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.vehicle.BoatEntity; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(BoatEntity.class) -public class BoatEntityMixin { - @Inject(at = @At("HEAD"), method = "interact", cancellable = true) - private void interact(PlayerEntity player, Hand hand, CallbackInfoReturnable cir) { - Block block = Registry.BLOCK.get(Registry.ITEM.getId(player.getMainHandStack().getItem())); - BoatEntity instance = (BoatEntity)(Object)this; - if (player.isSneaking()) { - if (block.hasBlockEntity()) { - World world = player.getEntityWorld(); - ChestBoatEntity chestBoat = new ChestBoatEntity(world, instance.getX(), instance.getY(), instance.getZ()); - world.spawnEntity(chestBoat); - chestBoat.copyPositionAndRotation(instance); - chestBoat.setBlockEntity(Registry.ITEM.getId(player.getMainHandStack().getItem()).toString()); - player.getMainHandStack().decrement(1); - instance.remove(); - cir.setReturnValue(ActionResult.SUCCESS); - } - } - } -} diff --git a/src/main/java/net/arbee/addola/mixins/EntityRendererMixin.java b/src/main/java/net/arbee/addola/mixins/EntityRendererMixin.java deleted file mode 100644 index 9747265..0000000 --- a/src/main/java/net/arbee/addola/mixins/EntityRendererMixin.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.arbee.addola.mixins; - -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.text.Text; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyArgs; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; - -import java.awt.*; - -@Mixin(EntityRenderer.class) -public abstract class EntityRendererMixin { - @ModifyArgs(method = "renderLabelIfPresent", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/text/Text;FFIZLnet/minecraft/util/math/Matrix4f;Lnet/minecraft/client/render/VertexConsumerProvider;ZII)I", ordinal = 1)) - public void draw (Args args, T entity, Text text, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { - float healthPercent = ((LivingEntity)entity).getHealth() / ((LivingEntity)entity).getMaxHealth(); - args.set(3, getCol(healthPercent)); - } - - public int getCol(float percent) { - int p = (int)(255 * percent); - return new Color(255, p, p).hashCode(); - } -} \ No newline at end of file diff --git a/src/main/java/net/arbee/addola/mixins/LivingEntityRendererMixin.java b/src/main/java/net/arbee/addola/mixins/LivingEntityRendererMixin.java deleted file mode 100644 index 190fde3..0000000 --- a/src/main/java/net/arbee/addola/mixins/LivingEntityRendererMixin.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.arbee.addola.mixins; - -import net.minecraft.client.render.entity.EntityRenderDispatcher; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.LivingEntityRenderer; -import net.minecraft.client.render.entity.PlayerModelPart; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.util.math.Vector3f; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Formatting; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(LivingEntityRenderer.class) -public abstract class LivingEntityRendererMixin> extends EntityRenderer implements FeatureRendererContext { - protected LivingEntityRendererMixin(EntityRenderDispatcher dispatcher) { - super(dispatcher); - } - - @Inject(method = "setupTransforms", at = @At(value = "TAIL")) - protected void setupTransforms(T entity, MatrixStack matrices, float animationProgress, float bodyYaw, float tickDelta, CallbackInfo ci) { - if (entity.hasCustomName() || entity instanceof PlayerEntity) { - String string = Formatting.strip(entity.getName().getString()); - if ("guendahr".equals(string) && (!(entity instanceof PlayerEntity) || ((PlayerEntity)entity).isPartVisible(PlayerModelPart.CAPE))) { - matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(180.0F)); - } - } - } -} diff --git a/src/main/java/net/arbee/addola/mixins/ServerWorldMixin.java b/src/main/java/net/arbee/addola/mixins/ServerWorldMixin.java index f5f5b1d..bdefe5c 100644 --- a/src/main/java/net/arbee/addola/mixins/ServerWorldMixin.java +++ b/src/main/java/net/arbee/addola/mixins/ServerWorldMixin.java @@ -1,6 +1,6 @@ package net.arbee.addola.mixins; -import net.arbee.addola.registries.AddolaGamerules; +import net.arbee.addola.registries.Gamerules; import net.minecraft.entity.LivingEntity; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; @@ -21,11 +21,11 @@ public class ServerWorldMixin { public void inject(CallbackInfo ci) { for (int i = 0; i < players.size(); i++) { LivingEntity player = players.get(i); - int gameruleInt = player.getEntityWorld().getGameRules().getInt(AddolaGamerules.HEAL_ON_SLEEP); + int gameruleInt = player.getEntityWorld().getGameRules().getInt(Gamerules.HEAL_ON_SLEEP); player.setHealth(Math.min(player.getHealth() + gameruleInt, player.getMaxHealth())); - if(player.getEntityWorld().getGameRules().getBoolean(AddolaGamerules.CURE_EFFECTS_SLEEP)) { + if(player.getEntityWorld().getGameRules().getBoolean(Gamerules.CURE_EFFECTS_SLEEP)) { player.clearStatusEffects(); } } diff --git a/src/main/java/net/arbee/addola/network/SpawnChestBoatEntityPacketSender.java b/src/main/java/net/arbee/addola/network/SpawnChestBoatEntityPacketSender.java index fa0e866..ed0d150 100644 --- a/src/main/java/net/arbee/addola/network/SpawnChestBoatEntityPacketSender.java +++ b/src/main/java/net/arbee/addola/network/SpawnChestBoatEntityPacketSender.java @@ -2,114 +2,31 @@ import io.netty.buffer.Unpooled; import net.arbee.addola.entity.vehicle.ChestBoatEntity; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.network.PacketContext; -import net.fabricmc.fabric.api.network.ServerSidePacketRegistry; import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; -import net.minecraft.client.MinecraftClient; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.network.Packet; import net.minecraft.network.PacketByteBuf; import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; - -import java.util.UUID; public class SpawnChestBoatEntityPacketSender { public static final Identifier IDENTIFIER = new Identifier("addola", "spawn_chestboat"); public static Packet createSpawnPacket(final ChestBoatEntity boatEntity) { - if (boatEntity.world.isClient) - throw new IllegalStateException("SpawnPacketUtil.create called on the logical client!"); - PacketByteBuf byteBuf = new PacketByteBuf(Unpooled.buffer()); - byteBuf.writeVarInt(Registry.ENTITY_TYPE.getRawId(boatEntity.getType())); - byteBuf.writeUuid(boatEntity.getUuid()); - byteBuf.writeVarInt(boatEntity.getEntityId()); - - PacketBufUtil.writeVec3d(byteBuf, boatEntity.getPos()); - PacketBufUtil.writeAngle(byteBuf, boatEntity.pitch); - PacketBufUtil.writeAngle(byteBuf, boatEntity.yaw); - return ServerPlayNetworking.createS2CPacket(IDENTIFIER, byteBuf); + final PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer()); + buf.writeInt(boatEntity.getEntityId()); + buf.writeUuid(boatEntity.getUuid()); + buf.writeDouble(boatEntity.getX()); + buf.writeDouble(boatEntity.getY()); + buf.writeDouble(boatEntity.getZ()); + final Vec3d velocity = boatEntity.getVelocity(); + buf.writeDouble(velocity.x); + buf.writeDouble(velocity.y); + buf.writeDouble(velocity.z); + buf.writeFloat(boatEntity.getPitch(1)); + buf.writeFloat(boatEntity.yaw); + return ServerPlayNetworking.createS2CPacket(IDENTIFIER, buf); } - public static final class PacketBufUtil { - - /** - * Packs a floating-point angle into a {@code byte}. - * - * @param angle - * angle - * @return packed angle - */ - public static byte packAngle(float angle) { - return (byte) MathHelper.floor(angle * 256 / 360); - } - - /** - * Unpacks a floating-point angle from a {@code byte}. - * - * @param angleByte - * packed angle - * @return angle - */ - public static float unpackAngle(byte angleByte) { - return (angleByte * 360) / 256f; - } - - /** - * Writes an angle to a {@link PacketByteBuf}. - * - * @param byteBuf - * destination buffer - * @param angle - * angle - */ - public static void writeAngle(PacketByteBuf byteBuf, float angle) { - byteBuf.writeByte(packAngle(angle)); - } - - /** - * Reads an angle from a {@link PacketByteBuf}. - * - * @param byteBuf - * source buffer - * @return angle - */ - public static float readAngle(PacketByteBuf byteBuf) { - return unpackAngle(byteBuf.readByte()); - } - - /** - * Writes a {@link Vec3d} to a {@link PacketByteBuf}. - * - * @param byteBuf - * destination buffer - * @param vec3d - * vector - */ - public static void writeVec3d(PacketByteBuf byteBuf, Vec3d vec3d) { - byteBuf.writeDouble(vec3d.x); - byteBuf.writeDouble(vec3d.y); - byteBuf.writeDouble(vec3d.z); - } - - /** - * Reads a {@link Vec3d} from a {@link PacketByteBuf}. - * - * @param byteBuf - * source buffer - * @return vector - */ - public static Vec3d readVec3d(PacketByteBuf byteBuf) { - double x = byteBuf.readDouble(); - double y = byteBuf.readDouble(); - double z = byteBuf.readDouble(); - return new Vec3d(x, y, z); - } + private SpawnChestBoatEntityPacketSender() { } } diff --git a/src/main/java/net/arbee/addola/registries/AddolaEntities.java b/src/main/java/net/arbee/addola/registries/AddolaEntities.java deleted file mode 100644 index 525a009..0000000 --- a/src/main/java/net/arbee/addola/registries/AddolaEntities.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.arbee.addola.registries; - -import net.arbee.addola.entity.vehicle.ChestBoatEntity; -import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; -import net.minecraft.entity.EntityDimensions; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - -public class AddolaEntities { - public static final EntityType CHESTBOAT = Registry.register( - Registry.ENTITY_TYPE, - new Identifier("addola", "oak_chestboat"), - FabricEntityTypeBuilder.create(SpawnGroup.MISC, ChestBoatEntity::new).dimensions(EntityDimensions.fixed(1.375f, 0.5625f)).build() - ); - - public static void setupEntities() { - - } -} diff --git a/src/main/java/net/arbee/addola/registries/AddolaItems.java b/src/main/java/net/arbee/addola/registries/AddolaItems.java deleted file mode 100644 index 8bcefce..0000000 --- a/src/main/java/net/arbee/addola/registries/AddolaItems.java +++ /dev/null @@ -1,45 +0,0 @@ -package net.arbee.addola.registries; - -import net.arbee.addola.client.render.BoatItemRenderer; -import net.arbee.addola.client.render.ChestBoatItemRenderer; -import net.arbee.addola.item.ChestBoatItem; -import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; -import net.fabricmc.fabric.api.item.v1.FabricItemSettings; -import net.minecraft.entity.vehicle.BoatEntity; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.Items; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; - -public class AddolaItems { - public static final ChestBoatItem OAK_CHESTBOAT_ITEM = new ChestBoatItem(BoatEntity.Type.OAK, new FabricItemSettings().group(ItemGroup.TRANSPORTATION).maxCount(1)); - public static final ChestBoatItem JUNGLE_CHESTBOAT_ITEM = new ChestBoatItem(BoatEntity.Type.JUNGLE, new FabricItemSettings().group(ItemGroup.TRANSPORTATION).maxCount(1)); - public static final ChestBoatItem ACACIA_CHESTBOAT_ITEM = new ChestBoatItem(BoatEntity.Type.ACACIA, new FabricItemSettings().group(ItemGroup.TRANSPORTATION).maxCount(1)); - public static final ChestBoatItem DARKOAK_CHESTBOAT_ITEM = new ChestBoatItem(BoatEntity.Type.DARK_OAK, new FabricItemSettings().group(ItemGroup.TRANSPORTATION).maxCount(1)); - public static final ChestBoatItem BIRCH_CHESTBOAT_ITEM = new ChestBoatItem(BoatEntity.Type.BIRCH, new FabricItemSettings().group(ItemGroup.TRANSPORTATION).maxCount(1)); - public static final ChestBoatItem SPRUCE_CHESTBOAT_ITEM = new ChestBoatItem(BoatEntity.Type.SPRUCE, new FabricItemSettings().group(ItemGroup.TRANSPORTATION).maxCount(1)); - - public static void setupItems() { - Registry.register(Registry.ITEM, new Identifier("addola", "oak_chestboat"), OAK_CHESTBOAT_ITEM); - Registry.register(Registry.ITEM, new Identifier("addola", "jungle_chestboat"), JUNGLE_CHESTBOAT_ITEM); - Registry.register(Registry.ITEM, new Identifier("addola", "acacia_chestboat"), ACACIA_CHESTBOAT_ITEM); - Registry.register(Registry.ITEM, new Identifier("addola", "dark_oak_chestboat"), DARKOAK_CHESTBOAT_ITEM); - Registry.register(Registry.ITEM, new Identifier("addola", "birch_chestboat"), BIRCH_CHESTBOAT_ITEM); - Registry.register(Registry.ITEM, new Identifier("addola", "spruce_chestboat"), SPRUCE_CHESTBOAT_ITEM); - } - - public static void setupItemRenderers() { - BuiltinItemRendererRegistry.INSTANCE.register(Items.ACACIA_BOAT, new BoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(Items.OAK_BOAT, new BoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(Items.BIRCH_BOAT, new BoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(Items.DARK_OAK_BOAT, new BoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(Items.JUNGLE_BOAT, new BoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(Items.SPRUCE_BOAT, new BoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(OAK_CHESTBOAT_ITEM, new ChestBoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(SPRUCE_CHESTBOAT_ITEM, new ChestBoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(BIRCH_CHESTBOAT_ITEM, new ChestBoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(JUNGLE_CHESTBOAT_ITEM, new ChestBoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(ACACIA_CHESTBOAT_ITEM, new ChestBoatItemRenderer()); - BuiltinItemRendererRegistry.INSTANCE.register(DARKOAK_CHESTBOAT_ITEM, new ChestBoatItemRenderer()); - } -} diff --git a/src/main/java/net/arbee/addola/registries/AddolaCommands.java b/src/main/java/net/arbee/addola/registries/Commands.java similarity index 92% rename from src/main/java/net/arbee/addola/registries/AddolaCommands.java rename to src/main/java/net/arbee/addola/registries/Commands.java index e6d721e..d08f2a6 100644 --- a/src/main/java/net/arbee/addola/registries/AddolaCommands.java +++ b/src/main/java/net/arbee/addola/registries/Commands.java @@ -3,7 +3,7 @@ import net.arbee.addola.server.command.PlayerstatCommand; import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; -public class AddolaCommands { +public class Commands { public static void setupCommands() { CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> { PlayerstatCommand.register(dispatcher); diff --git a/src/main/java/net/arbee/addola/registries/AddolaGamerules.java b/src/main/java/net/arbee/addola/registries/Gamerules.java similarity index 97% rename from src/main/java/net/arbee/addola/registries/AddolaGamerules.java rename to src/main/java/net/arbee/addola/registries/Gamerules.java index 83684d0..7f47830 100644 --- a/src/main/java/net/arbee/addola/registries/AddolaGamerules.java +++ b/src/main/java/net/arbee/addola/registries/Gamerules.java @@ -4,7 +4,7 @@ import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry; import net.minecraft.world.GameRules; -public class AddolaGamerules { +public class Gamerules { public static GameRules.Key BERRYBUSH_SNEAK_DAMAGE; public static GameRules.Key VILLAGERS_FOLLOW; public static GameRules.Key HEAL_ON_SLEEP; diff --git a/src/main/resources/addola.mixins.json b/src/main/resources/addola.mixins.json index 4ebd93b..726d77b 100644 --- a/src/main/resources/addola.mixins.json +++ b/src/main/resources/addola.mixins.json @@ -6,10 +6,7 @@ "client": [ "BerryMixin", "BoatEntityAccess", - "BoatEntityMixin", "BoatItemAccess", - "EntityRendererMixin", - "LivingEntityRendererMixin", "ServerWorldMixin", "VillagerMixin" ], diff --git a/src/main/resources/assets/addola/lang/en_us.json b/src/main/resources/assets/addola/lang/en_us.json index b824ea3..928af1f 100644 --- a/src/main/resources/assets/addola/lang/en_us.json +++ b/src/main/resources/assets/addola/lang/en_us.json @@ -29,11 +29,5 @@ "gamerule.berryBushSneakDamage": "Deal Berry-bush damage while sneaking", "gamerule.villagersFollow": "Villagers follow Players holding Emerald Blocks/Ore", "gamerule.cureEffectsOnSleep": "Sleeping in a Bed cures any Effects.", - "gamerule.healOnSleep": "Sleeping in a Bed heals the player by a specific amount.", - "item.addola.oak_chestboat": "Oak Boat", - "item.addola.dark_oak_chestboat": "Dark Oak Boat", - "item.addola.acacia_chestboat": "Acacia Boat", - "item.addola.birch_chestboat": "Birch Boat", - "item.addola.jungle_chestboat": "Jungle Boat", - "item.addola.spruce_chestboat": "Spruce Boat" + "gamerule.healOnSleep": "Sleeping in a Bed heals the player by a specific amount." } \ No newline at end of file diff --git a/src/main/resources/assets/addola/models/item/acacia_chestboat.json b/src/main/resources/assets/addola/models/item/acacia_chestboat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/addola/models/item/acacia_chestboat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/addola/models/item/birch_chestboat.json b/src/main/resources/assets/addola/models/item/birch_chestboat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/addola/models/item/birch_chestboat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/addola/models/item/dark_oak_chestboat.json b/src/main/resources/assets/addola/models/item/dark_oak_chestboat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/addola/models/item/dark_oak_chestboat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/addola/models/item/jungle_chestboat.json b/src/main/resources/assets/addola/models/item/jungle_chestboat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/addola/models/item/jungle_chestboat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/addola/models/item/oak_chestboat.json b/src/main/resources/assets/addola/models/item/oak_chestboat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/addola/models/item/oak_chestboat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/addola/models/item/spruce_chestboat.json b/src/main/resources/assets/addola/models/item/spruce_chestboat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/addola/models/item/spruce_chestboat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/models/item/acacia_boat.json b/src/main/resources/assets/minecraft/models/item/acacia_boat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/minecraft/models/item/acacia_boat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/models/item/birch_boat.json b/src/main/resources/assets/minecraft/models/item/birch_boat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/minecraft/models/item/birch_boat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/models/item/dark_oak_boat.json b/src/main/resources/assets/minecraft/models/item/dark_oak_boat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/minecraft/models/item/dark_oak_boat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/models/item/jungle_boat.json b/src/main/resources/assets/minecraft/models/item/jungle_boat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/minecraft/models/item/jungle_boat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/models/item/oak_boat.json b/src/main/resources/assets/minecraft/models/item/oak_boat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/minecraft/models/item/oak_boat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/models/item/spruce_boat.json b/src/main/resources/assets/minecraft/models/item/spruce_boat.json deleted file mode 100644 index e17276c..0000000 --- a/src/main/resources/assets/minecraft/models/item/spruce_boat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "parent": "minecraft:builtin/entity", - "display": { - "thirdperson_righthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "thirdperson_lefthand": { - "rotation": [ -90, 0, 180 ], - "scale": [ -0.3, 0.3, -0.3 ] - }, - "firstperson_righthand": { - "scale": [0.5, 0.5, 0.5] - }, - "firstperson_lefthand": { - "scale": [0.5, 0.5, 0.5] - }, - "ground": { - "scale": [0.2, 0.2, 0.2], - "translation": [0, 0.3, 0] - }, - "gui": { - "rotation": [ -90, 45, 135 ], - "scale": [ 0.4, 0.4, 0.4 ] - } - } - -} \ No newline at end of file diff --git a/src/main/resources/data/addola/tags/blocks/blocks_with_inventories.json b/src/main/resources/data/addola/tags/blocks/blocks_with_inventories.json deleted file mode 100644 index 21057d1..0000000 --- a/src/main/resources/data/addola/tags/blocks/blocks_with_inventories.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "replace": false, - "values": [ - "minecraft:barrel", - "minecraft:chest", - "minecraft:ender_chest", - "minecraft:trapped_chest", - "#minecraft:shulker_boxes" - ] -} \ No newline at end of file