From 3ea2d2e217f5fb16dfd4b4bc409f3584895e16ca Mon Sep 17 00:00:00 2001 From: kirderf1 Date: Thu, 26 Sep 2024 18:13:47 +0200 Subject: [PATCH] Holopad-focused code cleanup (#623) Removes the unused hologram entity (the current version of the holopad functions through its block entity renderer) and some code associated with it, and performs some general code cleanup on both the block and block entity. Changed the holopad to display a generic object instead of the contained item when the card isn't punched, instead of just when the card is empty. This is to make the holopad behave as if it was specifically reading the item off of the punched holes of the card. Fixed collision box. --- CHANGELOG.md | 2 + .../assets/minestuck/lang/en_us.json | 1 - .../block/machine/ComputerBlock.java | 5 +- .../minestuck/block/machine/HolopadBlock.java | 30 ++----- .../minestuck/block/machine/MachineBlock.java | 28 ------ .../blockentity/HolopadBlockEntity.java | 89 ++++++++----------- .../mraof/minestuck/client/ClientProxy.java | 3 +- .../renderer/blockentity/HolopadRenderer.java | 3 +- .../renderer/entity/HologramRenderer.java | 53 ----------- .../data/MinestuckEnUsLanguageProvider.java | 3 +- .../mraof/minestuck/entity/MSEntityTypes.java | 3 +- .../minestuck/entity/item/HologramEntity.java | 75 ---------------- .../models/block/holopad_has_card.json | 3 +- 13 files changed, 53 insertions(+), 245 deletions(-) delete mode 100644 src/main/java/com/mraof/minestuck/client/renderer/entity/HologramRenderer.java delete mode 100644 src/main/java/com/mraof/minestuck/entity/item/HologramEntity.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 3219ae2f3b..d9ebdbf102 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Perfectly generic and cindered signs work again - Fixed execution permissions for the `minestuck:command` dialogue trigger - Add missing wood-related recipes +- Updated holopad collision shape +- The block model for the holopad with card now renders with cutout ### Contributors for this release diff --git a/src/main/generated/resources/assets/minestuck/lang/en_us.json b/src/main/generated/resources/assets/minestuck/lang/en_us.json index f8c10e0d7b..e3ee6bb02f 100644 --- a/src/main/generated/resources/assets/minestuck/lang/en_us.json +++ b/src/main/generated/resources/assets/minestuck/lang/en_us.json @@ -1309,7 +1309,6 @@ "entity.minestuck.giclops.type": "%s Giclops", "entity.minestuck.grist": "Grist", "entity.minestuck.grist.type": "%s Grist", - "entity.minestuck.hologram": "Hologram", "entity.minestuck.iguana": "Iguana", "entity.minestuck.iguana.plural": "Iguanas", "entity.minestuck.iguana.sound": "Thip", diff --git a/src/main/java/com/mraof/minestuck/block/machine/ComputerBlock.java b/src/main/java/com/mraof/minestuck/block/machine/ComputerBlock.java index 6c292209e9..8e5a57d312 100644 --- a/src/main/java/com/mraof/minestuck/block/machine/ComputerBlock.java +++ b/src/main/java/com/mraof/minestuck/block/machine/ComputerBlock.java @@ -1,5 +1,6 @@ package com.mraof.minestuck.block.machine; +import com.mraof.minestuck.block.CustomVoxelShape; import com.mraof.minestuck.block.MSBlockShapes; import com.mraof.minestuck.block.MSProperties; import com.mraof.minestuck.blockentity.ComputerBlockEntity; @@ -44,7 +45,7 @@ public class ComputerBlock extends MachineBlock implements EntityBlock public static final Map COMPUTER_SHAPE = MSBlockShapes.COMPUTER.createRotatedShapes(); public static final Map LAPTOP_CLOSED_SHAPE = MSBlockShapes.LAPTOP_CLOSED.createRotatedShapes(); public static final Map LAPTOP_OPEN_SHAPE = MSBlockShapes.LAPTOP_OPEN.createRotatedShapes(); - public static final Map LUNCHTOP_CLOSED_SHAPE = createRotatedShapes(4, 0, 1.5, 12, 5, 8.5); + public static final Map LUNCHTOP_CLOSED_SHAPE = new CustomVoxelShape(new double[]{4, 0, 1.5, 12, 5, 8.5}).createRotatedShapes(); public static final Map LUNCHTOP_OPEN_SHAPE = MSBlockShapes.LUNCHTOP_OPEN.createRotatedShapes(); public static final Map OLD_COMPUTER_SHAPE = MSBlockShapes.OLD_COMPUTER.createRotatedShapes(); @@ -235,4 +236,4 @@ public String getSerializedName() return name().toLowerCase(); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/mraof/minestuck/block/machine/HolopadBlock.java b/src/main/java/com/mraof/minestuck/block/machine/HolopadBlock.java index 41ab26b56d..3ab9717e07 100644 --- a/src/main/java/com/mraof/minestuck/block/machine/HolopadBlock.java +++ b/src/main/java/com/mraof/minestuck/block/machine/HolopadBlock.java @@ -1,6 +1,7 @@ package com.mraof.minestuck.block.machine; import com.mraof.minestuck.block.BlockUtil; +import com.mraof.minestuck.block.CustomVoxelShape; import com.mraof.minestuck.block.MSProperties; import com.mraof.minestuck.blockentity.HolopadBlockEntity; import com.mraof.minestuck.blockentity.MSBlockEntityTypes; @@ -20,10 +21,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; @@ -34,21 +33,13 @@ @MethodsReturnNonnullByDefault public class HolopadBlock extends MachineBlock implements EntityBlock { - public static final Map SHAPE = createRotatedShapes(2, 0, 1, 14, 6, 13); - public static final Map COLLISION_SHAPE; - //todo these are unused? - protected static final AABB HOLOPAD_TOP_AABB = new AABB(3/16F, 6/16F, 2.6/16F, 13/16F, 7/16F, 12.6/16F); - protected static final AABB HOLOPAD_CARDSLOT_AABB = new AABB(4/16F, 0F, 13.8/16F, 12/16F, 10.1/16F, 15.94/16F); + public static final Map SHAPE = new CustomVoxelShape( + new double[]{2, 0, 1, 14, 7, 13}, + new double[]{4, 0, 13, 12, 10, 16} + ).createRotatedShapes(); public static final BooleanProperty HAS_CARD = MSProperties.HAS_CARD; - static - { - VoxelShape topShape = Block.box(3, 6, 3, 13, 7, 13); - COLLISION_SHAPE = createRotatedShapes(4, 0, 14, 12, 10, 16); - COLLISION_SHAPE.replaceAll((enumFacing, shape) -> Shapes.or(shape, topShape)); - } - public HolopadBlock(Properties builder) { super(builder); @@ -108,13 +99,4 @@ public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, Co { return SHAPE.get(state.getValue(FACING)); } - - @Override - @SuppressWarnings("deprecation") - public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) - { - return COLLISION_SHAPE.get(state.getValue(FACING)); - } - - -} \ No newline at end of file +} diff --git a/src/main/java/com/mraof/minestuck/block/machine/MachineBlock.java b/src/main/java/com/mraof/minestuck/block/machine/MachineBlock.java index c66d003e94..bc5a2aafec 100644 --- a/src/main/java/com/mraof/minestuck/block/machine/MachineBlock.java +++ b/src/main/java/com/mraof/minestuck/block/machine/MachineBlock.java @@ -1,9 +1,5 @@ package com.mraof.minestuck.block.machine; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -import com.mraof.minestuck.block.CustomVoxelShape; -import net.minecraft.core.Direction; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Mirror; @@ -13,12 +9,8 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.material.PushReaction; -import net.minecraft.world.phys.shapes.VoxelShape; import javax.annotation.Nullable; -import java.util.EnumMap; -import java.util.Map; -import java.util.function.Function; public abstract class MachineBlock extends Block { @@ -63,24 +55,4 @@ public BlockState mirror(BlockState state, Mirror mirrorIn) return state.rotate(mirrorIn.getRotation(state.getValue(FACING))); } - public static Map createRotatedShapes(CustomVoxelShape shape) - { - return Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, shape.create(Direction.NORTH), Direction.SOUTH, shape.create(Direction.SOUTH), Direction.WEST, shape.create(Direction.WEST), Direction.EAST, shape.create(Direction.EAST))); - } - - public static Map createRotatedShapes(double x1, double y1, double z1, double x2, double y2, double z2) - { - return Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, Block.box(x1, y1, z1, x2, y2, z2), Direction.SOUTH, Block.box(16 - x2, y1, 16 - z2, 16 - x1, y2, 16 - z1), - Direction.WEST, Block.box(z1, y1, 16 - x2, z2, y2, 16 - x1), Direction.EAST, Block.box(16 - z2, y1, x1, 16 - z1, y2, x2))); - } - - public static , V> Map createEnumMapping(Class c, K[] keys, Function function) - { - EnumMap map = Maps.newEnumMap(c); - for(K k : keys) - { - map.put(k, function.apply(k)); - } - return Maps.immutableEnumMap(map); - } } diff --git a/src/main/java/com/mraof/minestuck/blockentity/HolopadBlockEntity.java b/src/main/java/com/mraof/minestuck/blockentity/HolopadBlockEntity.java index 8fa21f6002..68fd9f3420 100644 --- a/src/main/java/com/mraof/minestuck/blockentity/HolopadBlockEntity.java +++ b/src/main/java/com/mraof/minestuck/blockentity/HolopadBlockEntity.java @@ -1,9 +1,9 @@ package com.mraof.minestuck.blockentity; +import com.mraof.minestuck.alchemy.AlchemyHelper; import com.mraof.minestuck.block.MSBlocks; import com.mraof.minestuck.block.machine.HolopadBlock; import com.mraof.minestuck.item.MSItems; -import com.mraof.minestuck.alchemy.AlchemyHelper; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -21,9 +21,8 @@ public class HolopadBlockEntity extends BlockEntity { - - public int innerRotation = 0; - protected ItemStack card = ItemStack.EMPTY; + private int rotationTicks = 0; + private ItemStack card = ItemStack.EMPTY; public HolopadBlockEntity(BlockPos pos, BlockState state) { @@ -33,33 +32,30 @@ public HolopadBlockEntity(BlockPos pos, BlockState state) public void onRightClick(Player player) { if(!card.isEmpty()) - { - if (player.getMainHandItem().isEmpty()) - player.setItemInHand(InteractionHand.MAIN_HAND, card); - else if (!player.getInventory().add(card)) - dropItem(false, level, worldPosition, card); - else player.inventoryMenu.broadcastChanges(); - - setCard(ItemStack.EMPTY); - return; - } + takeItem(player); else + insertHeldItem(player); + } + + private void takeItem(Player player) + { + if(player.getMainHandItem().isEmpty()) + player.setItemInHand(InteractionHand.MAIN_HAND, card); + else if(!player.getInventory().add(card)) + dropItem(false, level, worldPosition, card); + else player.inventoryMenu.broadcastChanges(); + + this.card = ItemStack.EMPTY; + updateState(); + } + + private void insertHeldItem(Player player) + { + ItemStack heldStack = player.getMainHandItem(); + if(card.isEmpty() && !heldStack.isEmpty() && heldStack.is(MSItems.CAPTCHA_CARD)) { - ItemStack heldStack = player.getMainHandItem(); - if (card.isEmpty()) - { - if (!heldStack.isEmpty() && heldStack.getItem() == MSItems.CAPTCHA_CARD.get()) - { - setCard(heldStack.split(1)); //Insert card into the card slot - ItemStack in = getCard(); - ItemStack item = new ItemStack(MSBlocks.GENERIC_OBJECT.get()); - - if (in.hasTag() && in.getTag().contains("contentID")) - item = AlchemyHelper.getDecodedItem(in); - } - - - } + this.card = heldStack.split(1); + updateState(); } } @@ -73,7 +69,6 @@ else if(!Block.canSupportCenter(level, pos.above(), Direction.DOWN)) else dropPos = pos; Containers.dropItemStack(level, dropPos.getX(), dropPos.getY(), dropPos.getZ(), item); - } public boolean hasCard() @@ -81,18 +76,6 @@ public boolean hasCard() return !this.getCard().isEmpty(); } - public void setCard(ItemStack card) - { - if (card.getItem() == MSItems.CAPTCHA_CARD.get() || card.isEmpty()) - { - this.card = card; - if(level != null) - { - updateState(); - } - } - } - public ItemStack getCard() { return this.card; @@ -100,28 +83,23 @@ public ItemStack getCard() public ItemStack getHoloItem() { - ItemStack in = getCard(); - ItemStack item = new ItemStack(MSBlocks.GENERIC_OBJECT.get()); - - if (in.hasTag() && in.getTag().contains("contentID")) - item = AlchemyHelper.getDecodedItem(in); + if(!AlchemyHelper.isPunchedCard(this.card)) + return new ItemStack(MSBlocks.GENERIC_OBJECT); - return item; + return AlchemyHelper.getDecodedItem(this.card); } @Override public void load(CompoundTag nbt) { super.load(nbt); - //broken = tagCompound.getBoolean("broken"); - setCard(ItemStack.of(nbt.getCompound("card"))); + this.card = ItemStack.of(nbt.getCompound("card")); } @Override public void saveAdditional(CompoundTag compound) { super.saveAdditional(compound); - //tagCompound.setBoolean("broken", this.broken); compound.put("card", card.save(new CompoundTag())); } @@ -139,9 +117,14 @@ public Packet getUpdatePacket() return ClientboundBlockEntityDataPacket.create(this); } + public int getRotationTickForRender() + { + return this.rotationTicks; + } + public static void clientTick(Level level, BlockPos pos, BlockState state, HolopadBlockEntity blockEntity) { - blockEntity.innerRotation++; + blockEntity.rotationTicks++; } private void updateState() @@ -154,4 +137,4 @@ private void updateState() level.setBlock(worldPosition, state.setValue(HolopadBlock.HAS_CARD, hasCard), Block.UPDATE_CLIENTS); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/mraof/minestuck/client/ClientProxy.java b/src/main/java/com/mraof/minestuck/client/ClientProxy.java index 5e87f7d749..595f0c76eb 100644 --- a/src/main/java/com/mraof/minestuck/client/ClientProxy.java +++ b/src/main/java/com/mraof/minestuck/client/ClientProxy.java @@ -61,7 +61,6 @@ public static void registerKeyMappings(RegisterKeyMappingsEvent event) public static void init(final FMLClientSetupEvent event) { EntityRenderers.register(MSEntityTypes.FROG.get(), FrogRenderer::new); - EntityRenderers.register(MSEntityTypes.HOLOGRAM.get(), HologramRenderer::new); EntityRenderers.register(MSEntityTypes.LOTUS_FLOWER.get(), LotusFlowerRenderer::new); EntityRenderers.register(MSEntityTypes.SERVER_CURSOR.get(), ServerCursorRenderer::new); EntityRenderers.register(MSEntityTypes.NAKAGATOR.get(), context -> new ConsortRenderer<>(context, EnumConsort.NAKAGATOR)); @@ -184,4 +183,4 @@ public static Player getClientPlayer() Minecraft mc = Minecraft.getInstance(); return mc.player; } -} \ No newline at end of file +} diff --git a/src/main/java/com/mraof/minestuck/client/renderer/blockentity/HolopadRenderer.java b/src/main/java/com/mraof/minestuck/client/renderer/blockentity/HolopadRenderer.java index 43f442c282..02aac82cd5 100644 --- a/src/main/java/com/mraof/minestuck/client/renderer/blockentity/HolopadRenderer.java +++ b/src/main/java/com/mraof/minestuck/client/renderer/blockentity/HolopadRenderer.java @@ -23,10 +23,9 @@ public void render(HolopadBlockEntity blockEntityIn, float partialTicks, PoseSta if(blockEntityIn.hasCard()) { ItemStack item = blockEntityIn.getHoloItem(); - float f = (float) blockEntityIn.innerRotation + partialTicks; poseStack.pushPose(); poseStack.translate(0.5F, 0.6F, 0.5F); - poseStack.mulPose(Axis.YP.rotation((f / 20.0F * 57.295776F) / 75)); + poseStack.mulPose(Axis.YP.rotation(((float) blockEntityIn.getRotationTickForRender() + partialTicks) / 20.0F)); Minecraft.getInstance().getItemRenderer().renderStatic(item, ItemDisplayContext.GROUND, combinedLightIn, combinedOverlayIn, poseStack, bufferIn, blockEntityIn.getLevel(), (int)blockEntityIn.getBlockPos().asLong()); poseStack.popPose(); } diff --git a/src/main/java/com/mraof/minestuck/client/renderer/entity/HologramRenderer.java b/src/main/java/com/mraof/minestuck/client/renderer/entity/HologramRenderer.java deleted file mode 100644 index e232fac5d4..0000000000 --- a/src/main/java/com/mraof/minestuck/client/renderer/entity/HologramRenderer.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.mraof.minestuck.client.renderer.entity; - -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Axis; -import com.mraof.minestuck.entity.item.HologramEntity; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.ItemDisplayContext; -import net.minecraft.world.item.ItemStack; - -public class HologramRenderer extends EntityRenderer -{ - - public HologramRenderer(EntityRendererProvider.Context context) - { - super(context); - } - - @Override - public void render(HologramEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) - { - ItemStack item = entityIn.getItem(); - float f = (float) entityIn.innerRotation + partialTicks; - float scale = 0.8f; - - RenderSystem.setShaderColor(0f, 1f, 1f, 0.5f); - poseStack.mulPose(Axis.ZP.rotationDegrees(180.0f)); - poseStack.scale(scale, scale, scale); - poseStack.translate(0.0D, 0.5D, 0.0D); - poseStack.mulPose(Axis.YP.rotation(f / 20.0F)); - Minecraft.getInstance().getItemRenderer().renderStatic(item, ItemDisplayContext.GROUND, packedLightIn, OverlayTexture.NO_OVERLAY, poseStack, bufferIn, entityIn.level(), entityIn.getId()); - poseStack.translate(0.0F, 0.0F, 0.0F); - - super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn); - } - - protected boolean shouldShowName(HologramEntity entity) - { - return super.shouldShowName(entity) && (entity.shouldShowName() || entity.hasCustomName() && entity == this.entityRenderDispatcher.crosshairPickEntity); - } - - @Override - public ResourceLocation getTextureLocation(HologramEntity entity) - { - return null; - } - -} diff --git a/src/main/java/com/mraof/minestuck/data/MinestuckEnUsLanguageProvider.java b/src/main/java/com/mraof/minestuck/data/MinestuckEnUsLanguageProvider.java index 22e9525d0c..6e509a0df2 100644 --- a/src/main/java/com/mraof/minestuck/data/MinestuckEnUsLanguageProvider.java +++ b/src/main/java/com/mraof/minestuck/data/MinestuckEnUsLanguageProvider.java @@ -1995,7 +1995,6 @@ protected void addTranslations() addEntityType(MSEntityTypes.MIDNIGHT_CREW_POSTER, "Midnight Crew Poster"); addEntityType(MSEntityTypes.SBAHJ_POSTER, "SBAHJ Poster"); addEntityType(MSEntityTypes.SHOP_POSTER, "Shop Sign"); - addEntityType(MSEntityTypes.HOLOGRAM, "Hologram"); addEntityType(MSEntityTypes.LOTUS_FLOWER, "Lotus Flower"); addGristType(GristTypes.BUILD, "Build"); @@ -2561,4 +2560,4 @@ protected void addTranslations() addEntitySubtitles(MSEntityTypes.GICLOPS, "hurt", "Giclops hurts"); addEntitySubtitles(MSEntityTypes.GICLOPS, "death", "Giclops dies"); } -} \ No newline at end of file +} diff --git a/src/main/java/com/mraof/minestuck/entity/MSEntityTypes.java b/src/main/java/com/mraof/minestuck/entity/MSEntityTypes.java index e3ff35ec50..6a0a073bf7 100644 --- a/src/main/java/com/mraof/minestuck/entity/MSEntityTypes.java +++ b/src/main/java/com/mraof/minestuck/entity/MSEntityTypes.java @@ -57,7 +57,6 @@ public final class MSEntityTypes public static final Supplier> MIDNIGHT_CREW_POSTER = REGISTER.register("midnight_crew_poster", () -> EntityType.Builder.of(CrewPosterEntity::new, MobCategory.MISC).sized(0.5F, 0.5F).setShouldReceiveVelocityUpdates(false).setTrackingRange(10).setUpdateInterval(Integer.MAX_VALUE).build(new ResourceLocation(Minestuck.MOD_ID, "midnight_crew_poster").toString())); public static final Supplier> SBAHJ_POSTER = REGISTER.register("sbahj_poster", () -> EntityType.Builder.of(SbahjPosterEntity::new, MobCategory.MISC).sized(0.5F, 0.5F).setShouldReceiveVelocityUpdates(false).setTrackingRange(10).setUpdateInterval(Integer.MAX_VALUE).build(new ResourceLocation(Minestuck.MOD_ID, "sbahj_poster").toString())); public static final Supplier> SHOP_POSTER = REGISTER.register("shop_poster", () -> EntityType.Builder.of(ShopPosterEntity::new, MobCategory.MISC).sized(0.5F, 0.5F).setShouldReceiveVelocityUpdates(false).setTrackingRange(10).setUpdateInterval(Integer.MAX_VALUE).build(new ResourceLocation(Minestuck.MOD_ID, "shop_poster").toString())); - public static final Supplier> HOLOGRAM = REGISTER.register("hologram", () -> EntityType.Builder.of(HologramEntity::new, MobCategory.MISC).sized(0.25F, 0.25F).setShouldReceiveVelocityUpdates(false).setTrackingRange(10).setUpdateInterval(Integer.MAX_VALUE).fireImmune().build(new ResourceLocation(Minestuck.MOD_ID, "hologram").toString())); public static final Supplier> LOTUS_FLOWER = REGISTER.register("lotus_flower", () -> EntityType.Builder.of(LotusFlowerEntity::new, MobCategory.MISC).sized(1.25F, 1.6F).setShouldReceiveVelocityUpdates(false).setTrackingRange(10).fireImmune().build(new ResourceLocation(Minestuck.MOD_ID, "lotus_flower").toString())); public static final Supplier> CONSUMABLE_PROJECTILE = REGISTER.register("consumable_projectile", () -> EntityType.Builder.of(ConsumableProjectileEntity::new, MobCategory.MISC).sized(0.25F, 0.25F).setTrackingRange(4).setUpdateInterval(10).fireImmune().build(new ResourceLocation(Minestuck.MOD_ID, "consumable_projectile").toString())); @@ -112,4 +111,4 @@ public static void onEntityAttributeCreation(EntityAttributeCreationEvent event) event.put(PLAYER_DECOY.get(), Mob.createMobAttributes().build()); } -} \ No newline at end of file +} diff --git a/src/main/java/com/mraof/minestuck/entity/item/HologramEntity.java b/src/main/java/com/mraof/minestuck/entity/item/HologramEntity.java deleted file mode 100644 index 83907a77fc..0000000000 --- a/src/main/java/com/mraof/minestuck/entity/item/HologramEntity.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.mraof.minestuck.entity.item; - -import com.mraof.minestuck.block.MSBlocks; -import com.mraof.minestuck.entity.MSEntityTypes; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.network.syncher.EntityDataSerializers; -import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; - -public class HologramEntity extends Entity -{ - - private static final EntityDataAccessor ITEM = SynchedEntityData.defineId(HologramEntity.class, EntityDataSerializers.ITEM_STACK); - public int innerRotation; - - public HologramEntity(Level level, ItemStack item) - { - this(MSEntityTypes.HOLOGRAM.get(), level, item); - } - - public HologramEntity(EntityType type, Level level, ItemStack item) - { - super(type, level); - this.innerRotation = this.random.nextInt(100000); - entityData.set(ITEM, item); - } - - public HologramEntity(EntityType type, Level level) - { - this(type, level, new ItemStack(MSBlocks.GENERIC_OBJECT.get())); - } - - @Override - protected void defineSynchedData() - { - this.entityData.define(ITEM, new ItemStack(MSBlocks.GENERIC_OBJECT.get())); - } - - @Override - protected void readAdditionalSaveData(CompoundTag compound) - { - if(compound.contains("Item")) - setItem(ItemStack.of(compound.getCompound("Item"))); - } - - @Override - protected void addAdditionalSaveData(CompoundTag compound) - { - compound.put("Item", this.getItem().save(new CompoundTag())); - } - - public ItemStack getItem() - { - return entityData.get(ITEM); - } - - public int getItemId() - { - return Item.getId(entityData.get(ITEM).getItem()); - } - - public void setItem(ItemStack item) - { - entityData.set(ITEM, item); - } - - public void setItem(int id) - { - } -} \ No newline at end of file diff --git a/src/main/resources/assets/minestuck/models/block/holopad_has_card.json b/src/main/resources/assets/minestuck/models/block/holopad_has_card.json index 45498c0178..8aedebec2d 100644 --- a/src/main/resources/assets/minestuck/models/block/holopad_has_card.json +++ b/src/main/resources/assets/minestuck/models/block/holopad_has_card.json @@ -1,5 +1,6 @@ { "credit": "Made with Blockbench", + "render_type": "cutout", "textures": { "2": "minestuck:block/machine/holopad/sigil", "3": "minestuck:block/machine/holopad/blank", @@ -249,4 +250,4 @@ "name": "card thing", "children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] }, 15, 16, 17, 18] -} \ No newline at end of file +}