Jump to content

Bugzoo

Members
  • Posts

    268
  • Joined

  • Last visited

Posts posted by Bugzoo

  1. 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?

  2. 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

  3. 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, "");
            	
    }

  4.   On 12/31/2014 at 6:13 PM, CraftCreeperDev said:

    Hi! How would I get the block that a player right clicked?

    I want this to work only when I have a certain (custom) item in my hand. How would I achieve this?

     

    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
    }

  5. 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;
            	
            }

  6.   On 12/22/2014 at 10:01 PM, diesieben07 said:

    Of course it crashes. You just checked if the entity is a wolf and then say "hey, treat this wolf as if it were a player". Good job. :o

     

    To get the owner, use getOwner on the wolf. Note that that will return null if the player is not online.

     

    Found that out a few minutes ago, but thanks anyway. How do I send a chat message to the owner?

  7. 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.

  8.   On 12/17/2014 at 9:04 PM, TheGreyGhost said:

    Hi

     

    What's the reason you set RenderItem.renderInFrame = true?

     

    Do you notice any pattern about when it renders correctly, and when it doesn't?  Could you post a couple of screenshots, one good, the other not?

     

    -TGG

     

    Sometimes when I run the game, the item renders here

    width=800 height=449bN1Tbrr.png?1 [/img]

     

    Then next time I run it (no code is changed) it renders here

    width=800 height=449cu8NK4w.png?1 [/img]

  9.   On 12/16/2014 at 9:16 AM, TheGreyGhost said:

    Hi

     

    Pls show your code (and class) for entMix?

     

    -TGG

     

    It doesn't have its own class, but I think this is the code you want

     

    public static ItemStack stackMix = new ItemStack(CookeryMod.Mix, 1, 0);
    public static EntityItem entMix = new EntityItem(Minecraft.getMinecraft().theWorld, 0D , 0D , 0D, stackMix);

  10. I have this code which renders an item on a block

    int randomX = (int) (rand.nextInt((int) ((.6 - 0.2) + 1)) + 0.1);
    
    		GL11.glPushMatrix();
    		RenderItem.renderInFrame = true;
    		GL11.glTranslatef((float) ((float)x + .5), (float) ((float)y + .1), (float) ((float)z + 0.1));
    		GL11.glRotatef((float) 90, 180, 0, 1);
    
    	GL11.glScaled(1.5,1.5,1);
    
    	RenderManager.instance.renderEntityWithPosYaw(entMix, 0.0D, 0.1D, 0.0D, 90.0F, 0.0F);
    	RenderItem.renderInFrame = false;
    	GL11.glPopMatrix();	

     

    This code is supposed to render the item in the centre of the block. Sometimes when I run the game, it does render in the centre, but sometimes it doesn't

  11. I have a block and an item renders on it. I need the item to get bigger, because it is too small. Here is my code

     

    GL11.glPushMatrix();
    	RenderItem.renderInFrame = true;
    	GL11.glTranslatef((float) ((float)x + .5), (float) ((float)y + 0.1), (float) ((float)z + 0.2));
    	GL11.glRotatef((float) 90, 180, 0, 1);
    	RenderManager.instance.renderEntityWithPosYaw(entMix, 0.0D, 0.1D, 0.0D, 90.0F, 0.0F);
    	RenderItem.renderInFrame = false;
    	GL11.glPopMatrix();	

  12. I have a method which runs when I right click the block. The method sets it so whatever item you rightclick the block with, gets rendered on the block. But when I render the item on the block, it renders on all the other blocks aswell

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.