Jump to content

minecraftbigfoot

Members
  • Posts

    29
  • Joined

  • Last visited

Posts posted by minecraftbigfoot

  1. Thanks for all the help guys!

     

    Final method:

    public static void removeRecipes()
    	{
    		ItemStack result = null;
    		Map<ItemStack, ItemStack> recipes = FurnaceRecipes.instance().getSmeltingList();
    		Iterator<ItemStack> interator = recipes.keySet().iterator();
    		
    		while (interator.hasNext())
    		{
    		    ItemStack recipe = interator.next();
    		    result = recipes.get(recipe);
    			ItemStack stone = new ItemStack(Blocks.STONE, 1, 0);
    		    		    
    		    if (ItemStack.areItemStacksEqual(stone, result))
    		    {
    		    	interator.remove();
    		    }
    		}
    	}

     

     

    Thanks all <3

  2. Just now, Choonster said:

    Calling Map#remove with a new ItemStack on a Map with ItemStack keys won't do anything. ItemStack doesn't override Object#equals or Object#hashCode, so two ItemStacks are only considered to be the same key if they're the same object.

    Hence why I can't make it work this way. 

    	public static void removeRecipes()
    	{
    		Iterator interator = FurnaceRecipes.instance().getSmeltingList().entrySet().iterator();
    		
    		while (interator.hasNext())
    		{
    			ItemStack cobble = new ItemStack(Blocks.COBBLESTONE);
    		    
    		    if (interator.next().equals(cobble))
    		    	interator.remove();
    		}
    	}
    	

    Done this with normal stone and cobble as Jay suggested neither even changes a thing. Nothing is changed because it wants an object and I'm giving it an ItemStack.

  3. 8 minutes ago, Jay Avery said:

    I think all you should need to do is make a cobblestone ItemStack (instead of the stone stack you used in your initial code), and call remove using that. (I haven't specifically done this with furnace recipes, but from what I know about Maps I don't see a reason for it not to work!).

    		ItemStack cobble = new ItemStack(Blocks.COBBLESTONE);
    		FurnaceRecipes.instance().getSmeltingList().remove(cobble);

    Doesn't work, guess I will have to continue brainstorming. Thank you anyway Jay

  4. Iterating over it isn't working well.. because theres not an Interface for smelting to get the current recipe of the interator.

    56 minutes ago, Jay Avery said:

    Furnace recipes are a map of input->output. The remove method removes an entry with the given key, that is, input. So if you want to remove the cobblestone->stone recipe, you need to call remove with cobblestone.

    How would you go about calling this? I take it:

            FurnaceRecipes.instance().getSmeltingList().remove(stone)
    wouldn't work.

     

  5. Thank youu

     

    this is what I have so far :3

    	public static void removeRecipes()
    	{
    		Iterator<IRecipe> furnace = FurnaceRecipes.instance().getSmeltingList().iterator();
    		Iterator<IRecipe> iterator = CraftingManager.getInstance().getRecipeList().iterator();
    		
    		while (iterator.hasNext())
    		{
    		    IRecipe recipe = iterator.next();
    			ItemStack stone = new ItemStack(Blocks.STONE, 1, 0);
    
    		    if (recipe == null)
    			    continue;
    		    
    		    ItemStack output = recipe.getRecipeOutput();
    		    
    		    if (output != null && output.equals(stone))
    			    iterator.remove();
    		}
    	}

     

  6. package mod.brandy;
    
    import net.minecraft.init.Blocks;
    import net.minecraft.item.ItemStack;
    import net.minecraft.item.crafting.FurnaceRecipes;
    
    public class BrandyAntiRecipes {
    
    	public static void removeRecipes()
    	{
    		ItemStack stone = new ItemStack(Blocks.STONE, 1, 0);
    		FurnaceRecipes.instance().getSmeltingList().remove(stone);
    	}
    }

     

    This is called in my init() in my main class, however it does nothing. Clearly I've made a bit of a mistake :)

     

    thank you~

     

    version: 1.10

  7. Need a little help Null checking, thought that a valid null check was 

    •         if(plr.inventory.getCurrentItem().getItem() != null && plr.inventory.getCurrentItem().getItem().equals(BrandyWeapons.vorpalBlade))

    But I find this gives me a null pointer exception and errors, I'm being dumb right?

  8. Boom!

    if(event.getEntity() instanceof EntitySkeleton)
    			{
    				ItemStack stack = new ItemStack(Items.SKULL, 1, 0);
            		if(stack.stackSize > 1){stack.stackSize = 1;}
            		EntityItem drop = new EntityItem(attacked.worldObj, attacked.posX, attacked.posY, attacked.posZ, stack);
            		event.getDrops().add(drop);
            	}

     

    Thanks all, think I was just having a mental block, how things have changed over just a couple of years :')

  9. This doesn't drop a skull, though from what I can see it should.

    	//"skeleton", "wither", "zombie", "char", "creeper", "dragon"
    	@SubscribeEvent
    	public void entityDrops(LivingDropsEvent event) 
    	{		
    		Minecraft mc = Minecraft.getMinecraft();
    		EntityPlayer plr = mc.thePlayer;
    
    		if(plr.inventory.getCurrentItem().getItem().equals(BrandyWeapons.vorpalBlade))
    		{
    			if(event.getEntity().getEntityId() == 51){
    				event.getEntity().entityDropItem(new ItemStack(Items.SKULL, 1, 0), 0);}
    			if(event.getEntity().getEntityId() == 5){
    				event.getEntity().entityDropItem(new ItemStack(Items.SKULL, 1, 1), 0);}
    			if(event.getEntity().getEntityId() == 54){
    				event.getEntity().entityDropItem(new ItemStack(Items.SKULL, 1, 2), 0);}
    			if(event.getEntity() == plr){
    				event.getEntity().entityDropItem(new ItemStack(Items.SKULL, 1, 3), 0);}
    			if(event.getEntity().getEntityId() == 50){
    				event.getEntity().entityDropItem(new ItemStack(Items.SKULL, 1, 4), 0);}
    			if(event.getEntity().getEntityId() == 63){
    				event.getEntity().entityDropItem(new ItemStack(Items.SKULL, 1, 5), 0);}
    		}
    	}

    Wondering if it is because I am using EntityIDs?

  10. So, I have set up a "digital" compass in my mod.

    When you shift+right click it opens a GUI which you can use to turn it on or off.

    It is on then I have a renderer that pops at the top of the screen "DIRECTION_FACING" (being one of the four directions).

     

    The question I have is once it is turned on, I can put it in a chest and it will stay on, however once you leave game and rejoin you have to turn it on again. Is it possible to set it up so that if it is turned on its saved "on?" 

    I feel like maybe nbt could do it? I'm not experienced with nbt at all so any help is great! Thank you :P

  11. Just now, diesieben07 said:

    Oh, and as for code style: Drawing things in a constructor is ... well, ... terrible.

    Yeah, for my other item I chose to not do it in a constructor, ngl only drawing things in that constructor is because I can't be bothered to move anything aha xD

  12. Just now, diesieben07 said:

    You should only draw when the event type is ALL, not when it's anything but EXPERIENCE.

    Thank you, Sir.

    In case someone views this later, should now be:

     

    @SubscribeEvent
    	public void onRenderGui(RenderGameOverlayEvent.Post event)
    	{
    		if (event.getType() == ElementType.ALL) 
    		{
    			new GuiClickerCount(Minecraft.getMinecraft());
    		}
    	}

     

  13. public class GuiClickerCount extends Gui
    {
    	public GuiClickerCount(Minecraft clientIn)
    	{
    		ItemStack click = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem();
    		int color = 0xFFFFFF;
    		
    		if(click != null && click.getItem() == BrandyItems.clickerItem)
    		{
    
    			GL11.glPushMatrix();
    			{
    
    				ScaledResolution scaled = new ScaledResolution(clientIn);
    				int width = scaled.getScaledWidth();
    			
    				if(GuiClicker.count == "0")
    				{
    					this.drawString(Minecraft.getMinecraft().fontRendererObj, "No Clicks!", width - 65, 0 + 20,  color);
    				}
    				else if(GuiClicker.count == null)
    				{
    					this.drawString(Minecraft.getMinecraft().fontRendererObj, "No Clicks!", width - 65, 0 + 20,  color);
    				}
    				else
    				{
    					this.drawString(Minecraft.getMinecraft().fontRendererObj, "Clicks: " + GuiClicker.count, width - 65, 0 + 20,  color);
    				}
    				
                }
    			GL11.glPopMatrix();
    
    		}
    		
    	}
    
    }

    This is the full class, it is called here:

    	@SubscribeEvent
    	public void onRenderGui(RenderGameOverlayEvent.Post event)
    	{
    		if (event.getType() != ElementType.EXPERIENCE) 
    		{
    			new GuiClickerCount(Minecraft.getMinecraft());
    		}
    	}

     

  14. Changed the root of the PATH to my C: drive thinking the fact it was on my F: drive may have caused an issue, no difference once done. Reinstalled Java and the same, no difference. Tried to use 1.7.10 MCForge and it worked, until it stopped because of being unable to extract JNI properly. 

×
×
  • Create New...

Important Information

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