diff --git a/build.gradle b/build.gradle index 5da75bda..0d9992e5 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.parchmentmc.librarian.forgegradle' apply plugin: 'org.spongepowered.mixin' -version = '0.7.0' +version = '0.7.1' group = 'at.petra-k.hexcasting' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'hexcasting' diff --git a/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java b/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java index f2661bbc..1e3320c7 100644 --- a/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java +++ b/src/main/java/at/petrak/hexcasting/common/entities/EntityWallScroll.java @@ -40,8 +40,9 @@ public class EntityWallScroll extends HangingEntity implements IEntityAdditional public ItemStack scroll; public HexPattern pattern; - public List zappyPoints; public boolean isAncient; + // Client-side only! + public List zappyPoints; public EntityWallScroll(EntityType type, Level world) { super(type, world); @@ -58,10 +59,12 @@ public class EntityWallScroll extends HangingEntity implements IEntityAdditional var tag = scroll.getTag(); if (tag != null && tag.contains(ItemScroll.TAG_PATTERN)) { - var pattern = HexPattern.DeserializeFromNBT(tag.getCompound(ItemScroll.TAG_PATTERN)); - var pair = RenderLib.getCenteredPattern(pattern, 128, 128, 16f); - var dots = pair.getSecond(); - this.zappyPoints = RenderLib.makeZappy(dots, 10f, 0.8f, 0f); + this.pattern = HexPattern.DeserializeFromNBT(tag.getCompound(ItemScroll.TAG_PATTERN)); + if (this.level.isClientSide) { + var pair = RenderLib.getCenteredPattern(pattern, 128, 128, 16f); + var dots = pair.getSecond(); + this.zappyPoints = RenderLib.makeZappy(dots, 10f, 0.8f, 0f); + } this.isAncient = tag.contains(ItemScroll.TAG_OP_ID); } else { diff --git a/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java b/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java index 6350f4e2..37ce6c36 100644 --- a/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java +++ b/src/main/java/at/petrak/hexcasting/common/items/ItemScroll.java @@ -42,30 +42,29 @@ public class ItemScroll extends Item { ItemStack itemstack = ctx.getItemInHand(); if (player != null && !this.mayPlace(player, direction, itemstack, posInFront)) { return InteractionResult.FAIL; + } + var level = ctx.getLevel(); + var scrollStack = itemstack.copy(); + scrollStack.setCount(1); + var scrollEntity = new EntityWallScroll(level, posInFront, direction, scrollStack); + + // i guess + var compoundtag = itemstack.getTag(); + if (compoundtag != null) { + EntityType.updateCustomEntityTag(level, player, scrollEntity, compoundtag); + } + + if (scrollEntity.survives()) { + if (!level.isClientSide) { + scrollEntity.playPlacementSound(); + level.gameEvent(player, GameEvent.ENTITY_PLACE, posClicked); + level.addFreshEntity(scrollEntity); + } + + itemstack.shrink(1); + return InteractionResult.sidedSuccess(level.isClientSide); } else { - var level = ctx.getLevel(); - var scrollStack = itemstack.copy(); - scrollStack.setCount(1); - var scrollEntity = new EntityWallScroll(level, posInFront, direction, scrollStack); - - // i guess - var compoundtag = itemstack.getTag(); - if (compoundtag != null) { - EntityType.updateCustomEntityTag(level, player, scrollEntity, compoundtag); - } - - if (scrollEntity.survives()) { - if (!level.isClientSide) { - scrollEntity.playPlacementSound(); - level.gameEvent(player, GameEvent.ENTITY_PLACE, posClicked); - level.addFreshEntity(scrollEntity); - } - - itemstack.shrink(1); - return InteractionResult.sidedSuccess(level.isClientSide); - } else { - return InteractionResult.CONSUME; - } + return InteractionResult.CONSUME; } }