Jump to content

starwarsmace

Members
  • Posts

    333
  • Joined

  • Last visited

Posts posted by starwarsmace

  1. Hi, I'm posting again. I've been working on the tech system in my mod and I currently working on pipes. These pipes are supposed to transfer energy out of any TileEntity that's a PowerProvider and into any TileEntity that's a PowerAcceptor. That seems to be working fairly well, except that when the pipe grabs energy from a PowerProvider, it is adding power to the pipe but not removing it from the Provider. Here's where the transferPower() function is called:

     

    https://github.com/AnZaNaMa/EnergyTools/blob/master/src/main/java/com/AnZaNaMa/EnergyTools/Entity/TileEntity/TileEntityPipe.java#L56

     

    and here's the transferPower function:

     

    https://github.com/AnZaNaMa/EnergyTools/blob/master/src/main/java/com/AnZaNaMa/EnergyTools/api/Tech/PowerConnectable.java#L201

        public void subtractEnergy(int energy){
            this.energyContained = this.energyContained + energy;
        }
    

    Its never helpful to add energy when you want to be removing it. xD

     

  2. I have done that and am still messing something up. I really wish I could say I understood completely what my code is doing, but I really don't.

     

    I hope you don't kick me off of the forums but this is why I am here. Because I don't know what the code is doing and I'm having a lot of trouble figuring it out. The examples in vanilla forge 1.8.9 that I have seem to use different methods than the ones you are telling me here. At least registering seems to be different.

     

    I don't want to give up. When I get home I'm going to take the cow and trace through every call that seems to have to do with rendering to see if I can't figure things out more.

     

    Thanks for all of your help. Let me know if you think of other reasons why the rendering just is very broken.

    To really understand what your code is doing, you should look at all the functions called. Then look at the source code for those functions, go back till you understand what all the functions that are called inside that function. Then do the same for all the other ones.

  3. sounds like u need to do some kind of GL rotating, not rotating the texture

     

    I tried doing that, the problem is getting it perfectly aligned with the player.

    I have some really bad memories associated with aligning models with players...

    I was rendering a .obj model as a sword and it was hard. I had to change a number than restart minecraft. Till I found the perfect match. It was a painstaking process that took a long time.

    Then after I finished spending hours on trying to align it, I found out that in debugging mode, it will change it without you having to restart minecraft. So, just run it in debug mode and try looking for the perfect numbers.

     

     

     

  4. Right, I understood that's how you intend to implement it, but what exactly are you trying to do in terms of the game? I mean, why does the scythe move an item into the pouch? How are they related?

     

    For example, in my mod I have several projectile weapons that can each use different ammo which can be selected from the player's current inventory, but instead of storing that item in the projectile weapon, I just store the selected ammo type's index and retrieve it when needed.

     

    So, depending on what the relationship of the scythe and pouch is, you may not need to move things, is all I'm trying to say.

     

    To be honest, I really dont see why you would store something in a scythe and what a pouch would have anything to do with it.  :D

  5. I would opt for not moving anything at all - why not simply have the scythe hold an integer slot index for the pouch item? Or does the item have to exist in the scythe? Perhaps you could describe the concept in a little more detail?

    I think what he means is that the scythe inventory is completely unrelated from the pouch inventory. But, when you press a certain key it switches the item that's stored in the scythe, and moves it over the to the end of the pouch. But that first item in the pouch is moved over to the scythe inventory. It then moves over all the original pouch items one slot, so the scythe item is at the end.

  6. I have a scythe that can hold one item and a pouch that can hold nine items. I would like to swap the item in the scythe for the first item in the pouch, and move the items in the pouch up a slot and add the item from the scythe to the end. I would like this to work on a custom key press which I have already implemented. Which would be the best way to do this?

    Woah.

    Thats a whole lot of switching and moving...

    I think this is how I would do it:

    1. Set the scythe to pouch and the pouch to the scythe.

    2. Loop through the entire inventory of the pouch, and set the item to the slot before it by subtracting one from the slot number.

  7. i checked with forge 1448 , same crash though. I use a single ModCrafting class for recipe registering.

     

    My ItemModSword Class Is:

    package com.SackboyAlamode.Industrialization.item;
    
    import com.SackboyAlamode.Industrialization.Main;
    
    import net.minecraft.item.ItemSword;
    
    public class ItemModSword extends ItemSword{
    
    public ItemModSword(String unlocalizedName, ToolMaterial material) {
    	super(material);
    	this.setUnlocalizedName(unlocalizedName);
    	this.setTextureName(Main.MODID + ":" + unlocalizedName);
    
    }
    
    }
    
    
    My ModItems Class is:
    
    package com.SackboyAlamode.Industrialization.item;
    
    
    
    import com.SackboyAlamode.Industrialization.Main;
    
    import cpw.mods.fml.common.registry.GameRegistry;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    import net.minecraft.item.Item.ToolMaterial;
    import net.minecraftforge.common.util.EnumHelper;
    
    public final class ModItems {
    //Materials
    //("MaterialName", harvestLevel, durability, miningSpeed, damageVsEntites, enchantability);
    	public static ToolMaterial AWOOD = EnumHelper.addToolMaterial("AWOOD", 2, 512, 7.0F, 1.0F, 1);
    	public static ToolMaterial ASTONE = EnumHelper.addToolMaterial("ASTONE", 2, 1024, 7.0F, 2.0F, 5);
    	public static ToolMaterial AIRON = EnumHelper.addToolMaterial("AIRON", 2, 2048, 7.0F, 4.0F, 15);
    	public static ToolMaterial AGOLD = EnumHelper.addToolMaterial("AGOLD", 2, 256, 7.0F, 3.0F, 30);
    	public static ToolMaterial ADIAMOND = EnumHelper.addToolMaterial("ADIAMOND", 2, 8192, 6.0F, 6.0F, 10);
    	public static ToolMaterial BWOOD = EnumHelper.addToolMaterial("BWOOD", 2, 512, 7.0F, 1.5F, 1);
    	public static ToolMaterial BSTONE = EnumHelper.addToolMaterial("BSTONE", 2, 1024, 7.0F, 2.5F, 5);
    	public static ToolMaterial BIRON = EnumHelper.addToolMaterial("BIRON", 2, 2048, 7.0F, 7.0F, 15);
    	public static ToolMaterial BGOLD = EnumHelper.addToolMaterial("BGOLD", 2, 256, 7.0F, 5.0F, 30);
    	public static ToolMaterial BDIAMOND = EnumHelper.addToolMaterial("BDIAMOND", 2, 8192, 11.0F, 11.0F, 10);
    
    	//Items
    	public static Item woodGrindstone;
    	public static Item stoneGrindstone;
    	public static Item ironGrindstone;
    	public static Item goldGrindstone;
    	public static Item diamondGrindstone;
    	public static Item woodBroadsword;
    	public static Item stoneBroadsword;
    	public static Item ironBroadsword;
    	public static Item goldBroadsword;
    	public static Item diamondBroadsword;
    	public static Item sharpenedWoodBroadsword;
    	public static Item sharpenedStoneBroadsword;
    	public static Item sharpenedIronBroadsword;
    	public static Item sharpenedGoldBroadsword;
    	public static Item sharpenedDiamondBroadsword;
    
    public static final void init() {
    	//Creating Items
    		woodGrindstone = new Item().setUnlocalizedName("woodGrindstone").setCreativeTab(CreativeTabs.tabTools).setTextureName(Main.MODID + ":woodGrindstone");
    		stoneGrindstone = new Item().setUnlocalizedName("stoneGrindstone").setCreativeTab(CreativeTabs.tabTools).setTextureName(Main.MODID + ":stoneGrindstone");
    		ironGrindstone = new Item().setUnlocalizedName("ironGrindstone").setCreativeTab(CreativeTabs.tabTools).setTextureName(Main.MODID + ":ironGrindstone");
    		goldGrindstone = new Item().setUnlocalizedName("goldGrindstone").setCreativeTab(CreativeTabs.tabTools).setTextureName(Main.MODID + ":goldGrindstone");
    		diamondGrindstone = new Item().setUnlocalizedName("diamondGrindstone").setCreativeTab(CreativeTabs.tabTools).setTextureName(Main.MODID + ":diamondGrindstone");
    		woodBroadsword = new Item().setUnlocalizedName("woodBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":woodBroadsword");
    		stoneBroadsword = new Item().setUnlocalizedName("stoneBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":stoneBroadsword");
    		ironBroadsword = new Item().setUnlocalizedName("ironBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":ironBroadsword");
    		goldBroadsword = new Item().setUnlocalizedName("goldBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":goldBroadsword");
    		diamondBroadsword = new Item().setUnlocalizedName("diamondBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":diamondBroadsword");
    		sharpenedWoodBroadsword = new Item().setUnlocalizedName("sharpenedWoodBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":sharpenedWoodBroadsword");
    		sharpenedStoneBroadsword = new Item().setUnlocalizedName("sharpenedStoneBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":sharpenedStoneBroadsword");
    		sharpenedIronBroadsword = new Item().setUnlocalizedName("sharpenedIronBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":sharpenedIronBroadsword");
    		sharpenedGoldBroadsword = new Item().setUnlocalizedName("sharpenedGoldBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":sharpenedGoldBroadsword");
    		sharpenedDiamondBroadsword = new Item().setUnlocalizedName("sharpenedDiamondBroadsword").setCreativeTab(CreativeTabs.tabCombat).setTextureName(Main.MODID + ":sharpenedDiamondBroadsword");
    	//Registering Items
    		GameRegistry.registerItem(new ItemModSword("woodBroadsword", AWOOD), "woodBroadsword");
    		GameRegistry.registerItem(new ItemModSword("stoneBroadsword", ASTONE), "stoneBroadsword");
    		GameRegistry.registerItem(new ItemModSword("ironBroadsword", AIRON), "ironBroadsword");
    		GameRegistry.registerItem(new ItemModSword("goldBroadsword", AGOLD), "goldBroadsword");
    		GameRegistry.registerItem(new ItemModSword("diamondBroadsword", ADIAMOND), "diamondBroadsword");
    		GameRegistry.registerItem(new ItemModSword("sharpenedWoodBroadsword", BWOOD), "sharpenedWoodBroadsword");
    		GameRegistry.registerItem(new ItemModSword("sharpenedStoneBroadsword", BSTONE), "sharpenedStoneBroadsword");
    		GameRegistry.registerItem(new ItemModSword("sharpenedIronBroadsword", BIRON), "sharpenedIronBroadsword");
    		GameRegistry.registerItem(new ItemModSword("sharpenedGoldBroadsword", BGOLD), "sharpenedGoldBroadsword");
    		GameRegistry.registerItem(new ItemModSword("sharpenedDiamondBroadsword", BDIAMOND), "sharpenedDiamondBroadsword");
    		GameRegistry.registerItem(woodGrindstone, "woodGrindstone");
    		GameRegistry.registerItem(stoneGrindstone, "stoneGrindstone");
    		GameRegistry.registerItem(ironGrindstone, "ironGrindstone");
    		GameRegistry.registerItem(goldGrindstone, "goldGrindstone");
    		GameRegistry.registerItem(diamondGrindstone, "diamondGrindstone");
    }
    
    }
    
    My ModCrafting Class is:
    
    package com.SackboyAlamode.Industrialization.crafting;
    
    import com.SackboyAlamode.Industrialization.block.ModBlocks;
    import com.SackboyAlamode.Industrialization.item.ModItems;
    
    import cpw.mods.fml.common.registry.GameRegistry;
    import net.minecraft.init.Blocks;
    import net.minecraft.init.Items;
    import net.minecraft.item.ItemStack;
    
    
    public class ModCrafting {
    public static final void init() {
    //Recipes
    	//Blocks
    		GameRegistry.addRecipe(new ItemStack(ModBlocks.compressedWood), "ABA", "BAB", "ABA", 'A', Blocks.log, 'B', Blocks.planks);
    		GameRegistry.addRecipe(new ItemStack(ModBlocks.compressedStone), "ABA", "BAB", "ABA", 'A', Blocks.stone, 'B', Blocks.cobblestone);
    		GameRegistry.addRecipe(new ItemStack(ModBlocks.compressedSand), "ABA", "BAB", "ABA", 'A', Blocks.sand, 'B', Blocks.sandstone);
    		GameRegistry.addRecipe(new ItemStack(ModBlocks.compressedDirt), "ABA", "BAB", "ABA", 'A', Blocks.dirt, 'B', ModBlocks.mixedDirt);
    		GameRegistry.addRecipe(new ItemStack(ModBlocks.compressedGravel), "ABA", "BAB", "ABA", 'A', Blocks.gravel, 'B', Blocks.cobblestone);
    		GameRegistry.addRecipe(new ItemStack(ModBlocks.compressedCobblestone), "ABA", "BAB", "ABA", 'A', Blocks.cobblestone, 'B', Blocks.stone);
    		GameRegistry.addRecipe(new ItemStack(ModBlocks.lantern), "ABA", "BCB", "ABA", 'A', Blocks.planks, 'B', Items.paper, 'C', Blocks.torch);
    		GameRegistry.addRecipe(new ItemStack(ModBlocks.paperWrappedPlanks), "AAA", "ABA", "AAA", 'A', Items.paper, 'B', Blocks.planks);
    	//Items
    		GameRegistry.addRecipe(new ItemStack(ModItems.woodBroadsword), "CBA", "BAB", "DBC", 'C', Items.string, 'B', Blocks.planks, 'A', ModBlocks.compressedWood, 'D', Items.stick);
    		GameRegistry.addRecipe(new ItemStack(ModItems.stoneBroadsword), "CBA", "BAB", "DBC", 'C', Items.string, 'B', Blocks.stone, 'A', ModBlocks.compressedStone, 'D', Items.stick);
    		GameRegistry.addRecipe(new ItemStack(ModItems.ironBroadsword), "CBA", "BAB", "DBC", 'C', Items.string, 'B', Items.iron_ingot, 'A', Blocks.iron_block, 'D', Items.stick);
    		GameRegistry.addRecipe(new ItemStack(ModItems.goldBroadsword), "CBA", "BAB", "DBC", 'C', Items.string, 'B', Items.gold_ingot, 'A', Blocks.gold_block, 'D', Items.stick);
    		GameRegistry.addRecipe(new ItemStack(ModItems.diamondBroadsword), "CBA", "BAB", "DBC", 'C', Items.string, 'B', Items.diamond, 'A', Blocks.diamond_block, 'D', Items.stick);
    		GameRegistry.addRecipe(new ItemStack(ModItems.woodGrindstone), "ABA", "B B", "ABA", 'A', Blocks.planks, 'B', ModBlocks.compressedWood);
    		GameRegistry.addRecipe(new ItemStack(ModItems.stoneGrindstone), "ABA", "BCB", "ABA", 'A', Blocks.stone, 'B', ModBlocks.compressedStone, 'C', ModItems.woodGrindstone);
    		GameRegistry.addRecipe(new ItemStack(ModItems.ironGrindstone), "ABA", "BCB", "ABA", 'A', Items.iron_ingot, 'B', Blocks.iron_block, 'C', ModItems.stoneGrindstone);
    		GameRegistry.addRecipe(new ItemStack(ModItems.goldGrindstone), "ABA", "BCB", "ABA", 'A', Items.gold_ingot, 'B', Blocks.gold_block, 'C', ModItems.ironGrindstone);
    		GameRegistry.addRecipe(new ItemStack(ModItems.diamondGrindstone), "ABA", "BCB", "ABA", 'A', Items.diamond, 'B', Blocks.diamond_block, 'C', ModItems.goldGrindstone);
    //Shapeless Recipes
    	//Blocks
    		GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.mixedDirt), new Object[] {Blocks.gravel,Blocks.dirt});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedWoodBroadsword), new Object[] {ModItems.woodGrindstone,ModItems.woodBroadsword});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedWoodBroadsword), new Object[] {ModItems.woodBroadsword,ModItems.stoneGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedWoodBroadsword), new Object[] {ModItems.woodBroadsword,ModItems.ironGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedWoodBroadsword), new Object[] {ModItems.woodBroadsword,ModItems.goldGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedWoodBroadsword), new Object[] {ModItems.woodBroadsword,ModItems.diamondGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedStoneBroadsword), new Object[] {ModItems.stoneBroadsword,ModItems.stoneGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedStoneBroadsword), new Object[] {ModItems.stoneBroadsword,ModItems.ironGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedStoneBroadsword), new Object[] {ModItems.stoneBroadsword,ModItems.goldGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedStoneBroadsword), new Object[] {ModItems.stoneBroadsword,ModItems.diamondGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedIronBroadsword), new Object[] {ModItems.ironBroadsword,ModItems.ironGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedIronBroadsword), new Object[] {ModItems.ironBroadsword,ModItems.goldGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedIronBroadsword), new Object[] {ModItems.ironBroadsword,ModItems.diamondGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedGoldBroadsword), new Object[] {ModItems.goldBroadsword,ModItems.goldGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedGoldBroadsword), new Object[] {ModItems.goldBroadsword,ModItems.diamondGrindstone});
    		GameRegistry.addShapelessRecipe(new ItemStack(ModItems.sharpenedDiamondBroadsword), new Object[] {ModItems.diamondBroadsword,ModItems.diamondGrindstone});
    	//Items
    }
    
    
    
    }
    

     

     

     

     

    Thanks for the help guys, i am not going to be able to reply until tomorrow however and will check what you all have posted then. Again, thanks for the amazing assistance.

     

    Firstly,

     works wonders. 

     

    Secondly, none of the sword crafting recipes work?

     

     

  8. No need for keybindings...

    Just set the entity's

    [b]moveStrafing[/b]

    and

    [b]moveForward[/b]

    fields to the same value as the riding entity's

    moveStrafing

    and

    moveForward

    .

    Do that in the

    onLivingUpdate

    method of your entity (after the super call), check if it's ridden by anything of course (

    [b]riddenByEntity[/b]

    is not

    null

    ).

     

    To steer it, you'd need to set the

    [b]rotationYaw[/b]

    and

    [b]rotationYawHead[/b]

    fields of your entity to the ones of the riding one. Do it right before setting the move* fields.

    Also override

    [b]canBeSteered()[/b]

    and return true.

    Wow, I have to say you've got some of the best explanations. Very thorough, tells you where to look, and at the same time isn't spoonfeeding. Not sure you can get any better than that.  :P

  9. You can just use the variables in your TileEntity, it exists on the client, too.

     

    okayyyy...But what excactly am i sending in that packet then? Do i send the whole tileentity? If yes, how?

     

    This will probably help. Also, as diesieben said, you can send whatever you need to know on the client side. So if you want the amount of energy in the gui(I think that's what you want) you send the amount in the packet to the client.

  10. people from minecraftforum.net usually hate when their mods get posted in those sites, so I suppose you don't do anything to get your mod there; the webmaster puts does it if he feels like it.

     

    Said webmaster(s) shouldn't. They are illegally redistributing other's work, and sometimes claiming credit for it. If one or more of your mods ends up on one of these sites, you should immediately have them take it down.

    And how?

    Websites like 9minecraft.com don't give a **** about you and definitely are not going to take down the mod.

    I mean you can try and file a complaint to google to take it down but...

  11.  

    Wait in the render types, they have numbers, maybe I could copy/ modify one of the lever renderers or something. I'll see what I can come up with.

    Ok... im stumped...

    I really don't know what the heck the code for rendering the lever in RenderBlocks means... I think I should start from scratch...

    How exactly do I make the renderer...?

  12. Well, first you will also need to actually place the rail in the rotated form and, speaking of the rotated form, you will actually need a way to render that rotated model.

    Oh...

    Is the button and lever some type of special render in the render type? That would explain it....

    What handles rotated forms?

     

    Found this though...

    /**
         * The type of render function that is called for this block
         */
        public int getRenderType()
        {
            return 12;
        }
    

    Wait in the render types, they have numbers, maybe I could copy/ modify one of the lever renderers or something. I'll see what I can come up with.

  13. I have been trying to make rails that you put on any side of the block and it will still work. So like upside down riding.cheesy.gif

    Anyway, for the time being I'm just trying to be able to put the rail on any side of the block. Here is my code for it.

     

    package com.starwarsmace.sticky_rails.blocks;
    
    import static net.minecraftforge.common.util.ForgeDirection.EAST;
    import static net.minecraftforge.common.util.ForgeDirection.NORTH;
    import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
    import static net.minecraftforge.common.util.ForgeDirection.WEST;
    import static net.minecraftforge.common.util.ForgeDirection.UP;
    import static net.minecraftforge.common.util.ForgeDirection.DOWN;
    import net.minecraft.block.BlockRail;
    import net.minecraft.world.World;
    import net.minecraftforge.common.util.ForgeDirection;
    
    public class StickyRail extends BlockRail{
    public StickyRail(){
    	super();
    }
    
    
    
    	public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int orientation){
    	ForgeDirection dir = ForgeDirection.getOrientation(orientation);
    	return 	(dir == DOWN  && world.isSideSolid(x, y + 1, z, DOWN )) ||
    			(dir == UP    && world.isSideSolid(x, y - 1, z, UP   )) ||
    			(dir == NORTH && world.isSideSolid(x, y, z + 1, NORTH)) ||
    			(dir == SOUTH && world.isSideSolid(x, y, z - 1, SOUTH)) ||
    			(dir == WEST  && world.isSideSolid(x + 1, y, z, WEST )) ||
    			(dir == EAST  && world.isSideSolid(x - 1, y, z, EAST ));
    }
    
       
    public boolean canPlaceBlockAt(World world, int x, int y, int z){
        return 	world.isSideSolid(x - 1, y, z, EAST ) ||
        		world.isSideSolid(x + 1, y, z, WEST ) ||
        		world.isSideSolid(x, y, z - 1, SOUTH) ||
        		world.isSideSolid(x, y, z + 1, NORTH) ||
        		world.isSideSolid(x, y - 1, z, UP   ) ||
        		world.isSideSolid(x, y + 1, z, DOWN );
    }
    
    }
    

     

    It behaves almost exactly like a regular rail. I can't place it anywhere special like underneath or on the sides. What else special do you have to do? In the lever class this is all that was needed to be put on any side of a block. I must be missing something...

  14. its now saying Cannot instantiate the type Mod.EventHandler but for:

     

    public void Init(FMLInitializationEvent event) {

            MinecraftForge.EVENT_BUS.register(new EventHandler1());

            FMLCommonHandler.instance().bus().register(new EventHandler1());

     

    The "MinecraftForge" and "FMLCommonHandler"

    Don't register your eventhandler on both buses...

  15. So it all runs (the print outs show) but its not seeming to draw the box. Any input?

    Don't use drawTexturedModalRect use this:

     

    public static void drawTexturedQuadFit(double x, double y, double width, double height, double zLevel){
    	Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(x + 0, y + height, zLevel, 0,1); 
            tessellator.addVertexWithUV(x + width, y + height, zLevel, 1, 1);
            tessellator.addVertexWithUV(x + width, y + 0, zLevel, 1,0);
            tessellator.addVertexWithUV(x + 0, y + 0, zLevel, 0, 0);
            tessellator.draw();
    }
    

    And call that whenever you need to instead of the drawTexturedModalRect

    I dont think it will help with your problem but ok..

     

    Try putting the box at 0,0 and see if that works...

  16. So, like this?

     

    @SideOnly(Side.CLIENT)
    public class GuiCoinCollected extends Gui
    {
        private static final ResourceLocation texAchi = new ResourceLocation("textures/gui/achievement/achievement_background.png");
    
        /** Holds the instance of the game (Minecraft) */
        private Minecraft theGame;
    
        /** Holds the latest width scaled to fit the game window. */
        private int width;
    
        /** Holds the latest height scaled to fit the game window. */
        private int height;
        private String headerText;
        private String coinNameText;
        
        private RenderItem renderedItem;
        
        private boolean canUpdate;
    
        private long unlockedTime;
        
        public GuiCoinCollected(Minecraft mc) {
        	this.theGame = mc;
        	this.renderedItem = new RenderItem();
        	this.canUpdate = false;
        }
        
        private void updateWindowScale()
        {
        	//if(!theGame.theWorld.isRemote) {
        	System.out.println("STARTING WINDOW SCALE");
            GL11.glViewport(0, 0, this.theGame.displayWidth, this.theGame.displayHeight);
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
            this.width = this.theGame.displayWidth;
            this.height = this.theGame.displayHeight;
            ScaledResolution scaledresolution = new ScaledResolution(this.theGame, this.theGame.displayWidth, this.theGame.displayHeight);
            this.width = scaledresolution.getScaledWidth();
            this.height = scaledresolution.getScaledHeight();
            GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            GL11.glOrtho(0.0D, (double)this.width, (double)this.height, 0.0D, 1000.0D, 3000.0D);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
            GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
        	System.out.println("ENDING WINDOW SCALE");
        	//}
        }
        
        @SubscribeEvent(priority = EventPriority.NORMAL)
        public void onRenderExperienceBar(RenderGameOverlayEvent event) {
        	if(event.isCancelable() || event.type != ElementType.EXPERIENCE) {
        		return;
        	}
        	
        	updateGui();
        }
    
        public void updateGui() {
        	//if(!theGame.theWorld.isRemote) {
            if (this.unlockedTime != 0L && Minecraft.getMinecraft().thePlayer != null)
            {
            	System.out.println("PAST FIRST LINE!");
            	
                double d0 = (double)(Minecraft.getSystemTime() - this.unlockedTime) / 3000.0D;
    
                if (!this.canUpdate)
                {
                	System.out.println("canUpdate EQUALED FALSE!");
                	
                    if (d0 < 0.0D || d0 > 1.0D)
                    {
                       this.unlockedTime = 0L;
                       return;
                   }
               }
                else if (d0 > 0.5D)
                {
                    d0 = 0.5D;
                }
                
                System.out.println("STARTING RENDER");
    
                this.updateWindowScale();
                GL11.glDisable(GL11.GL_DEPTH_TEST);
                GL11.glDepthMask(false);
                double d1 = d0 * 2.0D;
    
                if (d1 > 1.0D)
                {
                    d1 = 2.0D - d1;
                }
    
                d1 *= 4.0D;
                d1 = 1.0D - d1;
    
                if (d1 < 0.0D)
                {
                    d1 = 0.0D;
                }
    
                d1 *= d1;
                d1 *= d1;
                int i = this.width - 160;
                int j = 0 - (int)(d1 * 36.0D);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                GL11.glEnable(GL11.GL_TEXTURE_2D);
                this.theGame.getTextureManager().bindTexture(texAchi);
                GL11.glDisable(GL11.GL_LIGHTING);
                this.drawTexturedModalRect(i, j, 96, 202, 160, 32);
                
            	System.out.println("RENDERED BOX");
    
                //if (this.field_146262_n)
                //{
                //    this.theGame.fontRenderer.drawSplitString(this.field_146265_j, i + 30, j + 7, 120, -1);
                //}
                //else
               // {
                    this.theGame.fontRenderer.drawString(this.headerText, i + 30, j + 7, -256);
                    this.theGame.fontRenderer.drawString(this.coinNameText, i + 30, j + 18, -1);
               // }
    
                RenderHelper.enableGUIStandardItemLighting();
                GL11.glDisable(GL11.GL_LIGHTING);
                GL11.glEnable(GL12.GL_RESCALE_NORMAL);
                GL11.glEnable(GL11.GL_COLOR_MATERIAL);
                GL11.glEnable(GL11.GL_LIGHTING);
                this.renderedItem.renderItemAndEffectIntoGUI(this.theGame.fontRenderer, this.theGame.getTextureManager(), new ItemStack(CrewMod.crewCoin), i + 8, j + ;
                GL11.glDisable(GL11.GL_LIGHTING);
                GL11.glDepthMask(true);
                GL11.glEnable(GL11.GL_DEPTH_TEST);
                
            	System.out.println("FINISHED RENDERING");
            }
        	//}
        }
        
        public void checkUnlockTime() {
        	if(this.unlockedTime != 0) {
        		updateGui();
        	}
        }
        
        public long setUnlockTime(long amount) {
        	System.out.println("SET UNLOCK TIME TO: " + amount);
        	return this.unlockedTime = amount;
        }
        
        public void setUnlockTime() {
        	this.unlockedTime = theGame.getSystemTime() + 2500L;
        	this.canUpdate = true;
        	updateGui();
        	System.out.println("SET UNLOCK TIME TO SYSTEM TIME");
        }
    }
    

    I don't see anything wrong with it at first glance. Run it and tell us if anything goes wrong.

  17. So I tested my mod in a regular Minecraft client after building it. When I tested it I noticed that many textures are missing that were there in the Eclipse executor. I've tried refreshing my dependencies but that didn't fix it. I checked the jar file and the textures are there. Any ideas about what happened?

     

    Let me try asking other people to fix the short circuit in my machine... without showing the machine!

     

    Show the code! :D

×
×
  • Create New...

Important Information

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