-
Posts
292 -
Joined
-
Last visited
Everything posted by _Cruelar_
-
Still doesn't work. What is wrong? package com.cruelar.cruelars_triforcemod.entities.projectiles; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityFishHook; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.Iterator; import java.util.List; public class Clawshot_Head extends Entity implements IEntityAdditionalSpawnData{ private EntityPlayer entityPlayer; public Entity caughtEntity; public Clawshot_Head.State currentState; private static final DataParameter<Integer> DATA_HOOKED_ENTITY; private boolean inGround; private int ticksInAir; public static ResourceLocation RESOURCE_LOCATION=new ResourceLocation("cruelars_triforcemod:textures/entity/projectiles/clawshot_head.png"); public Clawshot_Head(World world){ super(world); this.shoot(entityPlayer); } public Clawshot_Head(World world, EntityPlayer entityPlayer){ super(world); this.init(entityPlayer); this.currentState = Clawshot_Head.State.FLYING; this.setPosition((double)entityPlayer.posX,(double)entityPlayer.posY+entityPlayer.getEyeHeight(),(double)entityPlayer.posX); this.shoot(entityPlayer); } @SideOnly(Side.CLIENT) public Clawshot_Head(World world, EntityPlayer entityPlayer, double posX, double posY, double posZ) { super(world); this.init(entityPlayer); this.setPosition(posX,posY,posZ); this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; } public void notifyDataManagerChange(DataParameter<?> p_notifyDataManagerChange_1_) { if (DATA_HOOKED_ENTITY.equals(p_notifyDataManagerChange_1_)) { int i = (Integer)this.getDataManager().get(DATA_HOOKED_ENTITY); this.caughtEntity = i > 0 ? this.world.getEntityByID(i - 1) : null; } super.notifyDataManagerChange(p_notifyDataManagerChange_1_); } public void shoot(Entity entity) { System.out.println(entity); this.motionX=0.6D*entity.getLookVec().x; this.motionY=0.6D*entity.getLookVec().y; this.motionZ=0.6D*entity.getLookVec().z; } public void shoot(double p_shoot_1_, double p_shoot_3_, double p_shoot_5_, float p_shoot_7_, float p_shoot_8_){} private void init(EntityPlayer p_init_1_) { this.setSize(0.25F, 0.25F); this.ignoreFrustumCheck = true; this.entityPlayer = p_init_1_; } private void checkCollision() { Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ); Vec3d vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d, vec3d1, false, true, false); vec3d = new Vec3d(this.posX, this.posY, this.posZ); vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (raytraceresult != null) { vec3d1 = new Vec3d(raytraceresult.hitVec.x, raytraceresult.hitVec.y, raytraceresult.hitVec.z); entityPlayer.posX=this.posX; entityPlayer.posY=this.posY; entityPlayer.posZ=this.posZ; } Entity entity = null; List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(this.motionX, this.motionY, this.motionZ).grow(1.0D)); double d0 = 0.0D; Iterator var8 = list.iterator(); while(true) { Entity entity1; double d1; do { RayTraceResult raytraceresult1; do { do { do { if (!var8.hasNext()) { if (entity != null) { raytraceresult = new RayTraceResult(entity); } if (raytraceresult != null && raytraceresult.typeOfHit != RayTraceResult.Type.MISS) { if (raytraceresult.typeOfHit == RayTraceResult.Type.ENTITY) { this.caughtEntity = raytraceresult.entityHit; this.setHookedEntity(); } else { this.inGround = true; } } return; } entity1 = (Entity)var8.next(); } while(!this.canBeHooked(entity1)); } while(entity1 == this.entityPlayer && this.ticksInAir < 5); AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(0.30000001192092896D); raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1); } while(raytraceresult1 == null); d1 = vec3d.squareDistanceTo(raytraceresult1.hitVec); } while(d1 >= d0 && d0 != 0.0D); entity = entity1; d0 = d1; } } private void setHookedEntity() { this.getDataManager().set(DATA_HOOKED_ENTITY, this.caughtEntity.getEntityId() + 1); } protected boolean canBeHooked(Entity p_canBeHooked_1_) { return p_canBeHooked_1_.canBeCollidedWith() || p_canBeHooked_1_ instanceof EntityItem; } protected void entityInit() { this.getDataManager().register(DATA_HOOKED_ENTITY, 0); } @Override protected void readEntityFromNBT(NBTTagCompound nbtTagCompound) { } @Override protected void writeEntityToNBT(NBTTagCompound nbtTagCompound) { } static { DATA_HOOKED_ENTITY = EntityDataManager.createKey(EntityFishHook.class, DataSerializers.VARINT); } @Override public void writeSpawnData(ByteBuf buffer) { if (entityPlayer!=null) { buffer.writeInt(entityPlayer.getEntityId()); } } @Override public void readSpawnData(ByteBuf additionalData) { entityPlayer=(EntityPlayer) world.getEntityByID(additionalData.readInt()); } static enum State { FLYING, HOOKED_IN_ENTITY; private State() { } } }
-
Now I understand what you mean, but what should I write into writeSpawnData? I think I have to add the Player somehow to the ByteBuf but how would I write an EntityPlayer to it? package com.cruelar.cruelars_triforcemod.entities.projectiles; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityFishHook; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.Iterator; import java.util.List; public class Clawshot_Head extends Entity implements IEntityAdditionalSpawnData{ private EntityPlayer entityPlayer; public Entity caughtEntity; public Clawshot_Head.State currentState; private static final DataParameter<Integer> DATA_HOOKED_ENTITY; private boolean inGround; private int ticksInAir; public static ResourceLocation RESOURCE_LOCATION=new ResourceLocation("cruelars_triforcemod:textures/entity/projectiles/clawshot_head.png"); public Clawshot_Head(World world){ super(world); } public Clawshot_Head(World world, EntityPlayer entityPlayer){ super(world); this.init(entityPlayer); this.currentState = Clawshot_Head.State.FLYING; this.setPosition((double)entityPlayer.posX,(double)entityPlayer.posY+entityPlayer.getEyeHeight(),(double)entityPlayer.posX); this.shoot(entityPlayer); } @SideOnly(Side.CLIENT) public Clawshot_Head(World world, EntityPlayer entityPlayer, double posX, double posY, double posZ) { super(world); this.init(entityPlayer); this.setPosition(posX,posY,posZ); this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; } public void notifyDataManagerChange(DataParameter<?> p_notifyDataManagerChange_1_) { if (DATA_HOOKED_ENTITY.equals(p_notifyDataManagerChange_1_)) { int i = (Integer)this.getDataManager().get(DATA_HOOKED_ENTITY); this.caughtEntity = i > 0 ? this.world.getEntityByID(i - 1) : null; } super.notifyDataManagerChange(p_notifyDataManagerChange_1_); } public void shoot(Entity entity) { System.out.println(entity); this.motionX=0.6D*entity.getLookVec().x; this.motionY=0.6D*entity.getLookVec().y; this.motionZ=0.6D*entity.getLookVec().z; } public void shoot(double p_shoot_1_, double p_shoot_3_, double p_shoot_5_, float p_shoot_7_, float p_shoot_8_){} private void init(EntityPlayer p_init_1_) { this.setSize(0.25F, 0.25F); this.ignoreFrustumCheck = true; this.entityPlayer = p_init_1_; } private void checkCollision() { Vec3d vec3d = new Vec3d(this.posX, this.posY, this.posZ); Vec3d vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d, vec3d1, false, true, false); vec3d = new Vec3d(this.posX, this.posY, this.posZ); vec3d1 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (raytraceresult != null) { vec3d1 = new Vec3d(raytraceresult.hitVec.x, raytraceresult.hitVec.y, raytraceresult.hitVec.z); entityPlayer.posX=this.posX; entityPlayer.posY=this.posY; entityPlayer.posZ=this.posZ; } Entity entity = null; List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(this.motionX, this.motionY, this.motionZ).grow(1.0D)); double d0 = 0.0D; Iterator var8 = list.iterator(); while(true) { Entity entity1; double d1; do { RayTraceResult raytraceresult1; do { do { do { if (!var8.hasNext()) { if (entity != null) { raytraceresult = new RayTraceResult(entity); } if (raytraceresult != null && raytraceresult.typeOfHit != RayTraceResult.Type.MISS) { if (raytraceresult.typeOfHit == RayTraceResult.Type.ENTITY) { this.caughtEntity = raytraceresult.entityHit; this.setHookedEntity(); } else { this.inGround = true; } } return; } entity1 = (Entity)var8.next(); } while(!this.canBeHooked(entity1)); } while(entity1 == this.entityPlayer && this.ticksInAir < 5); AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(0.30000001192092896D); raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1); } while(raytraceresult1 == null); d1 = vec3d.squareDistanceTo(raytraceresult1.hitVec); } while(d1 >= d0 && d0 != 0.0D); entity = entity1; d0 = d1; } } private void setHookedEntity() { this.getDataManager().set(DATA_HOOKED_ENTITY, this.caughtEntity.getEntityId() + 1); } protected boolean canBeHooked(Entity p_canBeHooked_1_) { return p_canBeHooked_1_.canBeCollidedWith() || p_canBeHooked_1_ instanceof EntityItem; } protected void entityInit() { this.getDataManager().register(DATA_HOOKED_ENTITY, 0); } @Override protected void readEntityFromNBT(NBTTagCompound nbtTagCompound) { } @Override protected void writeEntityToNBT(NBTTagCompound nbtTagCompound) { } static { DATA_HOOKED_ENTITY = EntityDataManager.createKey(EntityFishHook.class, DataSerializers.VARINT); } @Override public void writeSpawnData(ByteBuf buffer) { } @Override public void readSpawnData(ByteBuf additionalData) { } static enum State { FLYING, HOOKED_IN_ENTITY; private State() { } } }
-
So something like this never happened to me, but I can give you a common problem while trying to join with several mods: 2 or more mods conflict with each other: Try to remove one try to play with remaining It still shows you that: Put the mod in again try again with rmoving the next mod in your list If not: Congrats, you've found the conflicting mod
-
So with classic System.out.println(entity) i got this [11:07:49] [Server thread/INFO] [STDOUT]: [com.cruelar.cruelars_triforcemod.entities.projectiles.Clawshot_Head:shoot:89]: EntityPlayerMP['Player87'/318, l='Triforce Test', x=227.66, y=95.00, z=265.97] [11:07:49] [main/INFO] [STDOUT]: [com.cruelar.cruelars_triforcemod.entities.projectiles.Clawshot_Head:shoot:89]: null This means the code finds the Player on Serverside but not on Client, I think Then I get this [11:13:10] [main/INFO] [STDOUT]: [com.cruelar.cruelars_triforcemod.entities.projectiles.Clawshot_Head:shoot:89]: EntityPlayerSP['Player636'/318, l='MpServer', x=227.66, y=95.00, z=265.97] [11:13:10] [Server thread/INFO] [STDOUT]: [com.cruelar.cruelars_triforcemod.entities.projectiles.Clawshot_Head:shoot:89]: EntityPlayerMP['Player636'/318, l='Triforce Test', x=227.66, y=95.00, z=265.97] [11:13:10] [main/INFO] [STDOUT]: [com.cruelar.cruelars_triforcemod.entities.projectiles.Clawshot_Head:shoot:89]: null He seems to have touble to get the normal Player.
-
@diesieben07 That may is right but it doesn't help me. I don't understand HOW this works, I don't want to know WHY this or the other thing is better. I've found something what might be the result of the Problem(see my post above) and hope that you guys can tell me how to solve this. Soory to be such an idiot that I don't understand what you mean with the posts above but I'm still quite new to forge and don't know much about networking. I simply tried to copy something from Vanilla and adapt to my needs what in the most cases works well.
-
Could anyone please tell me if the Problem results in the NPE in the error above and how to fix that. Cause I'm lost in Forge Javadoc and now completely confused. I've no idea what you mean with all this. I copied from Fishing hook as I thought the fishingrod Fishinghook relation is quite similar to the Clawshot clawshot_head relation. But I see this is quite complicated so what should I do.
-
I've haven't changed anything so far (except trying once with out the if(world!=remote)) because I don't have any idea what to do for example should my Entity implement the interface or the Renderer? If the Entity should: what I'm supposed to write into the methods of the interface? Same for the case the Renderer should implement it. Some example code could really help me.
-
So how would I use this? Also I've found an error while trying to use it (doesn't breaks the game) [13:02:45] [main/FATAL]: Error executing task java.util.concurrent.ExecutionException: java.lang.RuntimeException: A severe problem occurred during the spawning of an entity at (194.78415135238228, 74.54834158954293, 194.78415135238228) at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_152] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_152] at net.minecraft.util.Util.runTask(SourceFile:47) [Util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1086) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:397) [Minecraft.class:?] at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_152] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_152] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_152] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_152] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.RuntimeException: A severe problem occurred during the spawning of an entity at (194.78415135238228, 74.54834158954293, 194.78415135238228) at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:136) ~[EntitySpawnHandler.class:?] at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.process(EntitySpawnHandler.java:64) ~[EntitySpawnHandler.class:?] at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.lambda$channelRead0$0(EntitySpawnHandler.java:55) ~[EntitySpawnHandler.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_152] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_152] at net.minecraft.util.Util.runTask(SourceFile:46) ~[Util.class:?] ... 15 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedConstructorAccessor60.newInstance(Unknown Source) ~[?:?] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_152] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_152] at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:88) ~[EntitySpawnHandler.class:?] at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.process(EntitySpawnHandler.java:64) ~[EntitySpawnHandler.class:?] at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.lambda$channelRead0$0(EntitySpawnHandler.java:55) ~[EntitySpawnHandler.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_152] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_152] at net.minecraft.util.Util.runTask(SourceFile:46) ~[Util.class:?] ... 15 more Caused by: java.lang.NullPointerException at com.cruelar.cruelars_triforcemod.entities.projectiles.Clawshot_Head.shoot(Clawshot_Head.java:89) ~[Clawshot_Head.class:?] at com.cruelar.cruelars_triforcemod.entities.projectiles.Clawshot_Head.<init>(Clawshot_Head.java:33) ~[Clawshot_Head.class:?] at sun.reflect.GeneratedConstructorAccessor60.newInstance(Unknown Source) ~[?:?] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_152] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_152] at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.spawnEntity(EntitySpawnHandler.java:88) ~[EntitySpawnHandler.class:?] at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.process(EntitySpawnHandler.java:64) ~[EntitySpawnHandler.class:?] at net.minecraftforge.fml.common.network.internal.EntitySpawnHandler.lambda$channelRead0$0(EntitySpawnHandler.java:55) ~[EntitySpawnHandler.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_152] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_152] at net.minecraft.util.Util.runTask(SourceFile:46) ~[Util.class:?] ... 15 more Doesn't change anything.
-
That's what I've found in the console (should have specified that)
-
@Animefan8888 Results Valid JSON
-
No. The only thing about Json I've found: @fcelon still doesn't drop anything new code: { "pools": [ { "name":"cruelars_triforcemod:bokoblin_loot", "rolls": 4, "entries": [ { "type":"item", "name": "cruelars_triforcemod:bokoblin_heart", "weight": 1, "functions": [ { "function": "set_count", "count": { "min": 0, "max": 1 } } ] }, { "type": "item", "name": "cruelars_triforcemod:bokoblin_fang", "weight": 2 },{ "type": "item", "name": "cruelars_triforcemod:bokoblin_horn", "weight": 1, "functions": [ { "function": "set_count", "count": { "min": 0, "max": 1 } } ] },{ "type": "item", "name": "cruears_triforcemod:green_ruby", "weight": 3 } ] } ] }
-
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
I'm planning to make similar blocks for the different dungeon environments I'm designing. But I'm in early development so that's all stuff of the future. -
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
I haven't thought of that but this shouldn't be a Problem for me as I'm planning to use these Blocks as obstacles in dungeons not as Material for building invisible things. -
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
Thanks and to all: it would be very helpful if you could find solutions for my other topics -
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
@Legenes, @diesieben07 If it's ok to you, I'll mention you in my changelog false block is an air block that gets invisible when the lens of truth is hold -
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
@LegenesYour code actually solved the Problem! Thanks to everyone. -
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
[19:42:43] [main/WARN]: Unable to resolve texture due to upward reference: #all in minecraft:models/block/cube_all -
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
I get now an error with the json blockstates json { "forge_marker": 1, "defaults": { "model": "cruelars_triforcemod:dungeonbrick" }, "variants": { "normal": [{}], "inventory": [{}], "visible=false":{ "model": "cruelars_triforcemod:hidden_block" }, "visible=true":{ "model": "cruelars_triforcemod:hidden_block" } } } model json { "parent": "block/cube_all", "textures":{ "visible=true": "cruelars_triforcemod:blocks/air", "visible=false": "cruelars_triforcemod:blocks/dungeonbrick" } } -
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
oh sorry. I had the entityPlayer == null Problem since I started the topic and even before. thought it was because there are problems with world should have changed that by now -
[Reopened again][1.12.2] How to change blockstate based on helditem
_Cruelar_ replied to _Cruelar_'s topic in Modder Support
So I should use this? @Override public void update() { if (!this.getWorld().isRemote) { EntityPlayer entityPlayer = (EntityPlayer) this.getWorld().getClosestPlayer(this.pos.getX(), this.pos.getY(), this.pos.getZ(), -1.0, false); if (entityPlayer != null) { boolean visible = isVisible(); boolean shouldBeVisible = entityPlayer.getHeldItem(EnumHand.MAIN_HAND).getItem() == ModItems.lens_of_truth || entityPlayer.getHeldItem(EnumHand.OFF_HAND).getItem() == ModItems.lens_of_truth; if (visible != shouldBeVisible) { world.setBlockState(pos, world.getBlockState(pos).withProperty(Hidden_Block.VISIBLE, shouldBeVisible)); } } System.out.println(entityPlayer); } }