• Recently Browsing

    No registered users viewing this page.

  • Posts

    • ok thanks very muc 
    • You can use EntityPlayer#getHeldItem(Hand) here.   This is a useless cast.   target.setGlowing(!target.isGlowing())
    • Dirtying the entity (markDirty) does not send the update packet. Only a full block update will send it, or you can send it manually.   And yes, in my opinion the update packet (and update tag - there are actually two syncing mechanisms for tile entities, one for the initial chunk load and one for later updates) should not contain the full TE NBT, instead they should contain specialized data for what is needed on the client.
    • Thank you very much! With your help it works now for every mob I tested. My code now: @SubscribeEvent public static void onInteractEntity(PlayerInteractEvent.EntityInteract event) { PlayerEntity player = event.getPlayer(); Item usedItem; if(event.getHand() == MAIN_HAND) { usedItem = player.getHeldItemMainhand().getItem(); } else { usedItem = player.getHeldItemOffhand().getItem(); } if(!player.world.isRemote) { if (usedItem == ModItems.HIGHLIGHTER.get()) { Entity target = (Entity) event.getTarget(); if (target.isGlowing()) { target.setGlowing(false); } else { target.setGlowing(true); } } } }   Thank you very much!
    • OK, so if I understand you correctly, your point is that the client TileEntity has an Inventory but it's actually useless.  You can sync it if you like, and vanilla sometimes does, but it's not used for anything. When the player opens a container, the client container gets a temporary inventory which is synched with the server via the container, not via the tileentity.  Vanilla usually creates a new temporary inventory, but if the mod wants to use the useless client inventory in the TileEntity instead of creating a new temporary inventory, it may as well.   When I tried it that way in 1.12.2 it led to occasional random visual glitches under stress testing.  The problem was particularly noticeable for TrackedInts being stored in the TileEntity (for example - the furnace burn progress would jump back and forth because it was being updated simultaneously by the GUI (container) packets and the TileEntity update packets), but also occasionally occurred for items in the inventory.  However if you don't dirty the server TileEntity, or the TileEntity update packets do not synch the inventory (for example you are using a Capability), then I imagine it's not a problem.   I can't think of any reason a client TileEntity would need to know the contents of the Inventory, unless it is changing its rendering like the campfire does.  In which case using the client tileentity as the container inventory would be a bad idea, i.e. because the tile entity update packets and the container modifications would clash with each other.  The worst symptom would be visual glitches I imagine.   -TGG      
  • Topics

  • Who's Online (See full list)