• 0

    posted a message on SOLVED!! - Check what the player is holding in a block class

    UPDATE: Okay, so I found out that Minecraft.getMinecraft() has thePlayer which is nothing new, but I learned that this allows me to basically do the same thing as EntityPlayer. (I was under the impression it was missing a few things.) However...

        	EntityPlayer player = Minecraft.getMinecraft().thePlayer;
        	boolean holdingBarrier;
        	
        	if(player.getCurrentEquippedItem().getItem() == Item.getItemFromBlock(VanillaEnhanced.blockBarrier) && player.getCurrentEquippedItem().getItem() != null) {
        		holdingBarrier = true;
        	} else {
        		holdingBarrier = false;
        	}
    		if(player.capabilities.isCreativeMode == true && holdingBarrier == true) {



    (If you're wondering why there's a variable for checking what's in the hand instead of it just being where the last if statement is, I did this just as a placeholder to see what sets the holdingBarrier to true or false for testing. Once I get things working, I'll be cleaning this up.)
    So, here's a little snippet of code I'm having trouble with. The if statement with checking the item crashes the game. If I remove the .getItem() part, and the item.getItemFromBlock parts, instead of crashing, it will just ignore what the player is holding and always return false. If I remove the holding check completely, it'll successfully check the player's game mode but that's only half of what I want.

    If it helps, the block of code this is in, is in onDisplayTick in a block's code, and is marked with @SideOnly(Side.CLIENT). Please go easy on me if I'm missing something obvious; I'm new to code, but I want to get better.

    Posted in: Modification Development
  • 0

    posted a message on SOLVED!! - Check what the player is holding in a block class

    Hey, I'm trying to find out, within my block's class, if the player is holding the block, so that way a variable can be set for use in other areas in that block's class if that is true. I already know where I want to use this, and how I'll implement it, (I'm going to be using it to determine if the code in onDisplayTick will run by if checking if the player is holding the block, be it directly or through a variable, however I can get this done) just my only roadblock is getting that crucial held item check.
    Will I need to create a class for its ItemBlock and modify that, or can this be done solely within the block class? Any help is appreciated.


    On a slightly less important note, is there a way to get a block's texture from the items folder or vice versa? (I didn't make this a separate thread to avoid double posting, and also this isn't big enough of an issue to me to make a new thread, so I just slapped this extra question right here.)

    Posted in: Modification Development
  • 0

    posted a message on Remove default mob drop

    Me again.
    I've tried adding a new withered bones for wither skeletons. For the most part this works just fine but I can't remove just bones from their drops.

    		if(event.entity instanceof EntitySkeleton) {
    			
    			Random random = new Random();
    			int j = random.nextInt(4) + 1;
    			
    			ItemStack itemDrop = new ItemStack(VanillaEnhanced.itemWitheredBone, j);
    
    			if (((EntitySkeleton)event.entityLiving).getSkeletonType() == 1){
    				event.drops.remove(Items.bone); // LINE THAT WON'T WORK
    			}
    			
    			if (((EntitySkeleton)event.entityLiving).getSkeletonType() == 1 && random.nextInt(100) <= 75){
    				event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, itemDrop));
    			}
    			
    			}


    I've wrote a comment on the line that's SUPPOSED to make it not drop bones, but it doesn't seem to work.

    Posted in: Modification Development
  • 0

    posted a message on [Beta 1.7.3] Basic FOV Slider Mod

    Actually I'm good. New Frontier Craft adds its own FOV slider and doesn't scale the hand, which was added after I made my post.

    Posted in: Minecraft Mods
  • 0

    posted a message on [SOLVED] Checking for specific UUID

    Ya know how Notch drops an apple when he dies? I'm doing something similar with my own food item. (Anthracite is a test before I add the item.)
    Just as a fun little thing I wanted to add. Thanks.


    Open the spoiler to see me being an idiot.



    EDIT:

    Crash Report


    A few things I've tried: (Note Eclipse wanted me to change .getUUID to getUniqueID. I've also tried the same things below but with the version of the UUID that has the hyphen and no luck.)

    	@SubscribeEvent
    	public void onLivingDrop(LivingDropsEvent event) {
    		if(event.entity instanceof EntityPlayer) {
    			if(event.entity.getUniqueID().toString() == "390d0a3955414e8e8f07115bb41684c4") {
    			ItemStack itemDrop = new ItemStack(VanillaEnhanced.blockAnthracite, 1);
    				event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, itemDrop));
    			}
    			}
    		}




     @SubscribeEvent
     public void onLivingDrop(LivingDropsEvent event) {
     if(event.entity.getUniqueID().toString().equals("390d0a3955414e8e8f07115bb41684c4") == true {
     ItemStack itemDrop = new ItemStack(VanillaEnhanced.blockAnthracite, 1);
     event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, itemDrop));
     }
     }
     }




    	@SubscribeEvent
    	public void onLivingDrop(LivingDropsEvent event) {
    		if(event.entity instanceof EntityPlayer) {
    			if(event.entity.getUniqueID().toString().equals("390d0a3955414e8e8f07115bb41684c4")) {
    			ItemStack itemDrop = new ItemStack(VanillaEnhanced.blockAnthracite, 1);
    				event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, itemDrop));
    			}
    			}
    		}




    EDIT 2:
    Turns out the world decided to randomly die. I'll fix my world and try again.

    EDIT 3:
    Yep, it works. Thanks.

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Checking for specific UUID
        @SubscribeEvent
        public void onLivingDrop(LivingDropsEvent event) {
            if(event.entity instanceof EntityPlayer) {
                ItemStack itemDrop = new ItemStack(VanillaEnhanced.blockAnthracite, 1);
                    event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, itemDrop));
                }
            }
    }


    How can I make it so this checks for my UUID? (390d0a39-5541-4e8e-8f07-115bb41684c4)
    I tried a few different things here and nothing worked. I got weird errors. What's the correct way to check for a specific UUID?

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Armour model texture not working

    Wow! This fixed it! I hadn't even noticed I had imported the wrong thing! Thank you so much, it finally works!

    I will be more carefully checking my imports next time.

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Armour model texture not working

    The texture is exactly correct in the folder as shown in the OP screenshots.



    Here are the exact images used.

    Another clarification of my folders:

    Posted in: Modification Development
  • 0

    posted a message on Modifying default blocks

    I'm trying to modify the default fences and walls to connect to mine. However, the farthest I am able to get is my fence connects to it, but the vanilla fence doesn't connect back, leaving me with a weird half-and-half connection.

    I have found a way to subscribe to default events and change them. I got sheep to drop my Anthracite blocks, but so far that's the farthest I could get. I couldn't figure out what to write to make it check for fences.

    I saw something about BlockList, removing the vanilla entry and adding your version over it in a thread over at the Forge forums. I am trying desperately to find this thread again with no luck. I can't find any other way to change default blocks and information on how to do so is scarce.

    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Armour model texture not working

    Still nothing.



    	public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, String type)
    	{
    		if (itemstack.getItem() == VanillaEnhanced.itemEmeraldHelmet || itemstack.getItem() == VanillaEnhanced.itemEmeraldChestplate || itemstack.getItem() == VanillaEnhanced.itemEmeraldBoots)
    		{
    			return VanillaEnhanced.modid + ":textures/models/armor/emerald_layer_1.png";
    		}
    		
    		else if (itemstack.getItem() == VanillaEnhanced.itemEmeraldLeggings)
    		{
    			return VanillaEnhanced.modid + ":textures/models/armor/emerald_layer_2.png";
    		}
    		
    		else
    		{
    			return null;
    		}
    	}
    Posted in: Modification Development
  • 0

    posted a message on [SOLVED] Armour model texture not working

    So yeah, I'm at my wits' end here. I've tried everything I can possibly think of to absolutely no avail. No matter what I do the texture is ALWAYS white leather!

    Okay, so here's what I've followed so far:


    Specifically part 2. Not part 1, just part 2.
    When he uses @Override on the armour (getArmorTexture) it works fine. For me, I get an error.

    However, I believe I need this tag since otherwise what I typed is exactly correct!

    Yes, I later did catch the 'vemh' typo and changed it to 'venh' to no avail.


    I have no idea what's wrong here. I have tried a few different tutorials for 1.7.10... none worked, but all used @Override.

    package roadhog.venhanced.item;
    
    import java.lang.annotation.Target;
    
    import roadhog.venhanced.VanillaEnhanced;
    
    import com.sun.xml.internal.stream.Entity;
    
    import net.minecraft.init.Items;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemArmor;
    import net.minecraft.item.ItemArmor.ArmorMaterial;
    import net.minecraft.item.ItemStack;
    
    public class ItemEmeraldArmour extends ItemArmor {
    
    	public ItemEmeraldArmour(ArmorMaterial armourMaterial, int renderIndex, int armourType) {
    		super(armourMaterial, renderIndex, armourType);
    	}
    	
    	public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
    	{
    		return Items.emerald == par2ItemStack.getItem() ? true : super.getIsRepairable(par1ItemStack, par2ItemStack);
    		}
    	
    	public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
    	{
    		if(this.armorType == 2)
    		{
    			return "venh:textures/models/armor/emerald_layer_2.png";
    		}
    		return "venh:textures/models/armor/emerald_layer_1.png";
    	}
    }



    Here's the class code.
    Absolutely nothing has gotten me past the 'white leather' phase and it's driving me insane. Help is appreciated. I even looked at what other (working!!!) mods did for 1.7.10 and they also do the same thing! I even tried ignoring the error, which didn't fix anything. Why me?

    Posted in: Modification Development
  • 0

    posted a message on SOLVED - Ore generation troubles

    Is there a way to fix this?

    Posted in: Modification Development
  • 0

    posted a message on SOLVED - Ore generation troubles

    Alright so there's a weird thing I discovered with the ore gen code I showed. If the vein size is max 1 or 2, it won't generate anything.

    I tried making a copy of this class, where I removed the two min/maxVeinSize ints, and changing this line:

    		int veinSize = minVeinSize + random.nextInt(maxVeinSize - minVeinSize);


    To this:

     int veinSize = 1;

    But in doing this, no ore generates. If I change the value to 2, no ore. If I change it to 3, ore generates, and the vein size is randomly 1, 2, or 3. I tried looking for any math that would be causing this RNG but I couldn't find anything that links to the veinSize variable. For reference, here's the class I mentioned with the code I tried to edit to make the ores appear in veins of one. Again, the min and max vein size ints were removed since I just tried to set the veinSize itself to 1.

    https://pastebin.com/HDSURD6M
    This is the code. The veinSize, as you can see is set to 1. As I've said, this oddly generates no ore, only if the value is 3 or above. Obviously I don't want to make it 3 or above, I want it to be 1 just like with emeralds.

    Posted in: Modification Development
  • 0

    posted a message on SOLVED - Ore generation troubles

    I didn't make any custom menus or GUIs.

    Edit: Main post updated. I tried all day to fix it even going as far as to following the whole tutorial again. I give up for the night, I'll be back tomorrow.

    Edit 2: So it turns out the problem was caused by the vein min size and max size being the same (1). This is troublesome as I wanted the ore to only appear in veins of one. I suppose I could set the min size to 0 for now.

    Posted in: Modification Development
  • 0

    posted a message on SOLVED - Ore generation troubles

    It is that in 1.7.10 as well. I dug around some more and found what I was looking for, but you helped a lot and nothing would be solved without your help, thanks for helping out.
    The only thing I'm trying to work out now is why the ore generation code causes the game to crash. Hm...

    Posted in: Modification Development
  • To post a comment, please .