I have a model. When I right click on the model, I want the model to change. I have tried using booleans before
if(renderChangedModel == true){
//Render Code
}
But using that code makes it impossible for block NBT to work. What is the best way to do this?
I can't find any tutorials for reading/writing block NBT. If I give the block an item, the block changes model, so I want a tutorial which shows me how to make the change to the block I right clicked on and not every one of them
Ok, i wrote out some code using that method and stuff you told me. I might be doing this completely wrong, but my game is crashing
public static ArrayList<Block> BuildingBlocks;
CreativeTabs.tabBlock.displayAllReleventItems(BuildingBlocks);
for(num = 0; num<BuildingBlocks.size(); num++){
this.drawItemStack(new ItemStack(BuildingBlocks.get(num)), width / 2 - num * 20 + 100, height / 2 - heightNum, "");
}
you use the onBlockActivated method, like this
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(player.getHeldItem() != null && player.getHeldItem().getItem() == YOURITEMHERE){
//Do SOMETHING Here
}
I have a few blocks in a GUI. I render the blocks on the screen from a for loop. I add to the xCoords everytime the for loop runs so the blocks wont overlap. Though with this code, the blocks keep adding on the xCoords which makes them fly out of the screen. The xCoord variable is not static by the way. Here is my code
for(num = 0; num<BuildingBlocks.length; num++){
this.drawItemStack(new ItemStack(BuildingBlocks[num]), width / 2 - xCoords, height / 2 - 55, "");
xCoords += 1;
}
I want to list every single block in the Building Blocks creative tab, in one array. I don't want to type them all out one by one, how would I do it? (if it is possible)
Sorry if this is a (very) derpy question, but how do I get the EntityPlayer from an event. I have tried casting it as EntityPlayer, though no luck
@SubscribeEvent
public void onEntityLivingDeath(LivingDeathEvent event)
{
if (event.entityLiving instanceof EntityWolf && ((EntityWolf)event.entityLiving).isTamed())
{
((EntityPlayer) event.entityLiving).addChatComponentMessage(new ChatComponentText("Your Wolf Has Sadly Died"));
}
}
But it just crashes.