I'm creating a mod that is completely client side so modding the server side is not an option. I'm not altering the players health, I'm acting based on the current (nothing with the player itself).
So those events are server side only? Is there a way to intercept the packets that the server sends to the client in case of stuff like health change etc?
Do all events from Forge also work in multiplayer servers?
@SubscribeEvent
public void onHurt(LivingHurtEvent e) {
System.out.println(e.entity.getClass());
}
I find this doens't work in multiplayer servers. Is this correct?
How do I debug in online mode? What steps do I have to take and what parameters do I have to add to my run configuration? I couldn't find anything on the wiki or the forum about this.
You don't need those parameters, this is the fixed code:
@Override
public TileEntity createNewTileEntity() {
return new TileEntityDistillationChamberGag();
}
@Override
public TileEntity createNewTileEntity() {
return new TileEntityDistillationChamberGag(new TileEntityDistillationChamberFrame());
}
When you create the class, you could pass in the reference in the constructor and then assign it to a property. You could also create a method in the class that accepts the reference and does something with it. There are numerous ways to pass along reference to instances.
ClassCastExceptions arise when one tries to cast an instance of an ObjectA to ObjectB when ObjectA doesn't extend or implement ObjectB. For example if you have an ArrayList, a ClassCastExceptions will be thrown when you try to cast this to a Map. A good way to prevent this is to check before you cast:
if (ObjectA instanceof ObjectB) { /** Do your stuff **/ }
NullPointers arise when one uses a variable or a property while it hasn't been assigned yet. So if you create a variable like `String foo;` or `String foo = null;` and you start calling methods on it like foo.equalsIgnoreCase("bar") it throws an exception because foo is used as a string while it's a null. When you come across this a lot, try assigning values in your constructors more or make sure a value has been set before using it:
if (foo != null) { /** Do your stuff **/ }
Hope this helps.
So since stuff like iconString and unlocalizedName are protected and there isn't an easy way to get those (plus I'm not sure if Bukkit gives those items another name then default, then this value might differ), is there maybe a way to compare the itemIcon property?
I just want to to trigger a right click action on this item. The server needs to know I pressed the right mouse button. There is nothing going on, on the client side.
public ItemStack useItemRightClick(World p_77957_1_, EntityPlayer p_77957_2_)
{
return this.getItem().onItemRightClick(this, p_77957_1_, p_77957_2_);
}
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)
{
return p_77659_1_;
}
This doesn't appear to do a lot?