Jump to content

Awesome_Spider

Forge Modder
  • Posts

    892
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Awesome_Spider

  1. It's amazing what Eclipse can do.  Have you tried hovering your mouse over a class name?  Do that and click the green dot.

     

    Or you could hold down Ctrl on your keyboard and simply click on the class name. I use that a lot. :)

  2. I made a block that has it's own gui, when I rightClick it however, it does something really wierd. Here is a sceenshot:

    Nk5bvKV.png

    Here is my code:

     

     

    The gui:

    public class ArcaneHarnesserGui 
    			extends GuiScreen{
    public static final int GUI_ID = 20;
    
    private static final ResourceLocation guiTexture = new ResourceLocation("wizardry", "/textures/gui/arcaneHarnesserGui.png");
    
    private int ImageWidth = 176;
        private int ImageHeight = 166;
        
        @Override
        public void drawScreen(int x, int y, float par3){ 	
            int k = (this.width - this.ImageWidth) / 2;
            byte b0 = 2;
        	
        	this.drawTexturedModalRect(k, b0, 0, 0, this.ImageWidth, this.ImageHeight);
        	
        	this.mc.getTextureManager().bindTexture(guiTexture);
        }
    }
    

     

    The code in my block that opens the gui:

    @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
    	player.openGui(Wizardry.instance, ArcaneHarnesserGui.GUI_ID, world, x, y, z);
    
    	return true;
    }
    

     

    My guiHandler:

    public class GuiHandler
    			implements IGuiHandler {
    
        @Override
        public Object getServerGuiElement ( int ID, EntityPlayer player, World world, int x, int y, int z ) {
                return null;
        }
    
        @Override
        public Object getClientGuiElement ( int ID, EntityPlayer player, World world, int x, int y, int z ) {
        	Object result = null;
        	
                if (ID == ArcaneHarnesserGui.GUI_ID){
                        result = new ArcaneHarnesserGui();
                }
                		return result;
        }
    }
    

     

     

     

    Edit: Here is what it should look like:

    clX43Ll.png

  3. So I've made an entity, but the problem is when I spawn it with a spawn egg it doesn't render. Here is my code:

     

     

     

    Entity:

    public class ArcanePowerMatrix 
    			extends EntityLiving{
    
    
    
    public ArcanePowerMatrix(World world) {
    	super(world);
    }
    
    @Override
    protected void entityInit() {
    
    }
    
    @Override
    public void readEntityFromNBT(NBTTagCompound tags) {
    
    }
    
    @Override
    public void writeEntityToNBT(NBTTagCompound tags) {
    
    }
    }
    

    Model:

    public class ModelPowerMatrix extends ModelBase{
      //fields
        ModelRenderer Base;
        ModelRenderer MainCube;
        ModelRenderer littleCube;
        ModelRenderer littleCube2;
        ModelRenderer littleCube3;
        ModelRenderer littleCube4;
      
      public ModelPowerMatrix()
      {
        textureWidth = 128;
        textureHeight = 64;
        
          Base = new ModelRenderer(this, 0, 32);
          Base.addBox(-5F, 0F, -5F, 10, 1, 10);
          Base.setRotationPoint(0F, 23F, 0F);
          Base.setTextureSize(64, 32);
          Base.mirror = true;
          setRotation(Base, 0F, 0F, 0F);
          MainCube = new ModelRenderer(this, 0, 0);
          MainCube.addBox(-6F, -6F, -6F, 12, 12, 12);
          MainCube.setRotationPoint(0F, 11F, 0F);
          MainCube.setTextureSize(64, 32);
          MainCube.mirror = true;
          setRotation(MainCube, -0.7853982F, 0F, -0.7853982F);
          littleCube = new ModelRenderer(this, 50, 0);
          littleCube.addBox(-2F, -2F, -2F, 4, 4, 4);
          littleCube.setRotationPoint(5.5F, 5.5F, -11.5F);
          littleCube.setTextureSize(64, 32);
          littleCube.mirror = true;
          setRotation(littleCube, -0.7853982F, 0F, -0.7853982F);
          littleCube2 = new ModelRenderer(this, 50, 0);
          littleCube2.addBox(-2F, -2F, -2F, 4, 4, 4);
          littleCube2.setRotationPoint(5.5F, 5.5F, 11.5F);
          littleCube2.setTextureSize(64, 32);
          littleCube2.mirror = true;
          setRotation(littleCube2, -0.7853982F, 0F, -0.7853982F);
          littleCube3 = new ModelRenderer(this, 50, 0);
          littleCube3.addBox(-2F, -2F, -2F, 4, 4, 4);
          littleCube3.setRotationPoint(-2F, -3F, 0F);
          littleCube3.setTextureSize(64, 32);
          littleCube3.mirror = true;
          setRotation(littleCube3, -0.7853982F, 0F, -0.7853982F);
          littleCube4 = new ModelRenderer(this, 50, 0);
          littleCube4.addBox(-2F, -2F, -2F, 4, 4, 4);
          littleCube4.setRotationPoint(14F, 13F, 0F);
          littleCube4.setTextureSize(64, 32);
          littleCube4.mirror = true;
          setRotation(littleCube4, -0.7853982F, 0F, -0.7853982F);
      }
      
      public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
      {
        super.render(entity, f, f1, f2, f3, f4, f5);
        setRotationAngles(f, f1, f2, f3, f4, f5, entity);
        Base.render(f5);
        MainCube.render(f5);
        littleCube.render(f5);
        littleCube2.render(f5);
        littleCube3.render(f5);
        littleCube4.render(f5);
      }
      
      private void setRotation(ModelRenderer model, float x, float y, float z)
      {
        model.rotateAngleX = x;
        model.rotateAngleY = y;
        model.rotateAngleZ = z;
      }
      
      public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
      {
        super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
      }
    }
    

    Renderer:

    @SideOnly(Side.CLIENT)
    public class RenderPowerMatrix
    			extends RenderLiving{
    
    public RenderPowerMatrix(ModelBase modelBase, float shadowSize) {
    	super(modelBase, shadowSize);
    }
    
    @Override
    protected ResourceLocation getEntityTexture(Entity var1) {
    	return new ResourceLocation("wizardry", "/textures/entities/PowerMatrix.png");
    }
    }
    

    My entity is registered like this:

    registerEntity(ArcanePowerMatrix.class, "powerMatrix", 000, 000);
    

     

    registerEntity is like this:

    public void registerEntity(Class<? extends Entity> entityClass, String entityName, int bkEggColor, int fgEggColor) {
        	int id = EntityRegistry.findGlobalUniqueEntityId();
        	EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);
        	EntityList.entityEggs.put(Integer.valueOf(id), new EntityList.EntityEggInfo(id, bkEggColor, fgEggColor));
        }
    

     

    In ClientProxy my renderer is registered like this:

    RenderingRegistry.registerEntityRenderingHandler(ArcanePowerMatrix.class, new RenderPowerMatrix(new ModelPowerMatrix(), 0F));
    

     

     

  4. I've been follow a tutorial for creating a Gui, its outdated but it works fine... Until I get to the part about registering my GuiHandler. It mentions NetworkRegistry, which doesn't exist in 1.7, so what I'm wondering is, what is the alternative for NetworkRegistry? How do I register my GuiHandler? Thanks in Advance.

     

    My code, if needed:

     

     

     

    The tutorial I'm following:

    http://www.minecraftforge.net/wiki/Basic_GUI

  5. Thanks, and to multiple lines of lore?

    also do you have a place where i can find a list of the colors?

     

    Well for multipe lines, add more of these:

    par3List.add(EnumChatFormatting.DARK_PURPLE + 2ndLineOfLore);

     

    As for a list of colors, they are in the EnumChatFormatting class. If your using eclipse like I am, you can simply place your cursor in front of the EnumChatFormatting (and behind the dot) and click Ctrl + SPACE on your keyboard, it will bring up a list of colors, well sort of. Hope that wasn't too confusing. :)

  6. and one more question, how can i add lore to an item?

     

    Override addInformation like this:

     

    /**
         * allows items to add custom lines of information to the mouseover description
         */
        @Override
        public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
        	if (par1ItemStack.stackTagCompound != null) {
                String lineOfLore = "Lore You Want To Add";
    
                par3List.add(EnumChatFormatting.DARK_PURPLE + lineOfLore);
        	}
        }
    

     

    Oh and if you want a different color, you can change

    EnumChatFormatting.DARK_PURPLE

    to the color you want. Hope this helps. :)

×
×
  • Create New...

Important Information

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