• 0

    posted a message on Return an object from an entity

    SOLVED

    Posted in: Modification Development
  • 0

    posted a message on [Solved]TileEntity Error heldItem.Item and heldItem.Size

    This mapping 'snapshot_20161111' was designed for MC 1.10.2! Use at your own peril.This mapping 'snapshot_20161111' was designed for MC 1.10.2! Use at your own peril.

    #################################################
    ForgeGradle 2.2-SNAPSHOT-c438b06
    https://github.com/MinecraftForge/ForgeGradle
    #################################################
    Powered by MCP unknown
    http://modcoderpack.com
    by: Searge, ProfMobius, Fesh0r,
    R4wk, ZeuX, IngisKahn, bspkrs
    #################################################
    :deobfCompileDummyTask
    :deobfProvidedDummyTask
    :eclipseClasspath
    :eclipseJdt
    :eclipseProject
    :getVersionJson
    :extractNatives SKIPPED
    :extractUserdev UP-TO-DATE
    :getAssetIndex UP-TO-DATE
    :getAssets
    Current status: 109/1196 9%
    Current status: 208/1196 17%
    Current status: 282/1196 23%
    Current status: 379/1196 31%
    Current status: 554/1196 46%
    Current status: 585/1196 48%
    Current status: 662/1196 55%
    Current status: 809/1196 67%
    Current status: 882/1196 73%
    Current status: 956/1196 79%
    Current status: 1067/1196 89%
    :makeStart
    :makeEclipseCleanRunClient
    :makeEclipseCleanRunServer
    :eclipse

    BUILD SUCCESSFUL

    Total time: 1 mins 21.863 secs

    Posted in: Modification Development
  • 0

    posted a message on [Solved]TileEntity Error heldItem.Item and heldItem.Size
    Quote from UpcraftLP»

    not Forge version, MAPPINGS version.



    You're right, it's that problem I just downloaded a github code and I have the same errors.... Do you know how to fix that?


    I would really appreciate it

    Posted in: Modification Development
  • 0

    posted a message on [Solved]TileEntity Error heldItem.Item and heldItem.Size

    I use the latest version, but just in case I will try :(

    Posted in: Modification Development
  • 0

    posted a message on [Solved]TileEntity Error heldItem.Item and heldItem.Size
    Quote from UpcraftLP»

    after you check if heldItem.getItem() is equal to a chocolate bar, what is

    heldItem.getMaxStackSize();

    supposed to do?

    the equation of heldItem.stackSize-- would be heldItem.shrink(1).


    If it's supposed to do that, but I've already tried putting "heldItem.shrink (1);"
    And tells me that the method I try to use "shrink" is not defined in "ItemStack"




    Also try to put "stackSize" and tells me that the variable is private and true, in minecraft 1.10 was not private was in public. Thanks for your time
    Posted in: Modification Development
  • 0

    posted a message on [Solved]TileEntity Error heldItem.Item and heldItem.Size
    Quote from UpcraftLP»

    there were some Changes to the ItemStack class, you need to use getters and setters for the item and stacksize fields. I suggest you take a look at the ItemStack class itself to find out more ;)


    Thanks for answering, I did this, name call the ItemStack class and the error went but it does not fulfill its function which is to put and take an item, I do not know if it does not work, because I did wrong by putting "ItemStack heldItem" in "onBlockActivated"


    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side,ItemStack heldItem, float hitX, float hitY, float hitZ) {
    		if(!worldIn.isRemote) {
    			TileEntity tileEntity = worldIn.getTileEntity(pos);
    			if(tileEntity instanceof TileEntityJar) {
    				TileEntityJar jar = (TileEntityJar) tileEntity;
    				if(heldItem.getItem() != null){
    			    if(heldItem.getItem() == ModItems.chocolate_bar){
    			    	if(jar.addChocolate_bar()){
    			    		heldItem.getMaxStackSize();
    			    		return true;							
    						}
    					}
    					
    				}
    				jar.removeChocolate_bar();
    			}
    					
    		}
    		return true;
    	}
    Posted in: Modification Development
  • 0

    posted a message on [Solved]TileEntity Error heldItem.Item and heldItem.Size

    Upgrade from 1.10 to 1.11


    Help, on line 77 and 79 gives me an error for the text "heldItem.Item" and "heldItem.Size--;"

    package com.modding.WillyWonka.blocks;
    
    import java.util.List;
    
    import com.modding.WillyWonka.Reference;
    import com.modding.WillyWonka.WillyWonka;
    import com.modding.WillyWonka.init.ModItems;
    import com.modding.WillyWonka.tileentity.TileEntityJar;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.ITileEntityProvider;
    import net.minecraft.block.SoundType;
    import net.minecraft.block.material.Material;
    import net.minecraft.block.state.IBlockState;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.BlockRenderLayer;
    import net.minecraft.util.EnumFacing;
    import net.minecraft.util.EnumHand;
    import net.minecraft.util.math.AxisAlignedBB;
    import net.minecraft.util.math.BlockPos;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    
    public class BlockJar extends Block implements ITileEntityProvider {
    
    	// 1 / 16 = 0.0625
    
    	private static final AxisAlignedBB BOUNDING_BOX = new AxisAlignedBB(0.0625 * 4, 0, 0.0625 * 4, 0.0625 * 12,
    			0.0625 * 8, 0.0625 * 12);
    	private static final AxisAlignedBB COLLISION_BOX = new AxisAlignedBB(0.0625 * 5, 0, 0.0625 * 5, 0.0625 * 13,
    			0.0625 * 9, 0.0625 * 13);
    
    	public BlockJar() {
    		super(Material.GLASS);
    		setUnlocalizedName(Reference.WillyWonkanBlocks.JAR.getUnlocalizedName());
    		setRegistryName(Reference.WillyWonkanBlocks.JAR.getRegistryName());
    		setCreativeTab(WillyWonka.CREATIVE_TAB);
    		setSoundType(SoundType.GLASS);
    	}
    
    	@Override
    	public boolean isFullBlock(IBlockState state) {
    		return false;
    	}
    
    	@Override
    	public boolean isOpaqueCube(IBlockState state) {
    		return false;
    	}
    
    	public BlockRenderLayer getBlockLayer() {
    		return BlockRenderLayer.TRANSLUCENT;
    
    	}
    
    	@Override
    	public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
    		return BOUNDING_BOX;
    	}
    
    	@Override
    	public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
    			List<AxisAlignedBB> collidingBoxes, Entity entityIn) {
    		super.addCollisionBoxToList(pos, entityBox, collidingBoxes, COLLISION_BOX);
    
    	}
    
    	@Override
    	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
    			EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY) {
    		if (!worldIn.isRemote) {
    			TileEntity tileEntity = worldIn.getTileEntity(pos);
    			if (tileEntity instanceof TileEntityJar) {
    				TileEntityJar jar = (TileEntityJar) tileEntity;
    				if (heldItem.Item() == ModItems.chocolate) {
    					if (jar.addChocolate()) {
    						heldItem.Size--;
    
    					}
    
    				}
    			}
    
    		}
    
    		return true;
    	}
    
    	@Override
    	public TileEntity createNewTileEntity(World worldIn, int meta) {
    		return new TileEntityJar();
    	}
    
    }
    
    Posted in: Modification Development
  • 0

    posted a message on ERROR BLOCKS 1.11

    Thanks !!!! :D

    Posted in: Modification Development
  • 0

    posted a message on ERROR BLOCKS 1.11

    Hey guys, can you help me?


    I'm doing tests with minecraft modding in 1.10.2 but upgrade to 1.11. Everything works fine, but the blocks are not registered and does not throw an error, I've tried everything, but I can not register "Blocks" in the game ...



    init/Blocks.java :

    package com.modding.WillyWonka.init;
    
    import com.modding.WillyWonka.blocks.BlockChocolate;
    
    import net.minecraft.block.Block;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.renderer.block.model.ModelResourceLocation;
    import net.minecraft.item.Item;
    import net.minecraftforge.fml.common.registry.GameRegistry;
    
    public class ModBlocks {
    	
    	public static Block chocolate;
    	
    	public static void  init() {
    		chocolate = new BlockChocolate();
    		
    		
    	}
    	
    	public static void register() {
    		
    		GameRegistry.register(chocolate);
    	
    		
    	}
    
    	public static void registerRenders() {
    		
    		registerRender(chocolate);
    
    	}
    	
    	private static void registerRender(Block block){
    		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));}
    }


    Blocks/BlockChocolate.java :

    package com.modding.WillyWonka.blocks;
    
    import com.ibm.icu.text.DisplayContext.Type;
    import com.modding.WillyWonka.Reference;
    import com.modding.WillyWonka.WillyWonka;
    import com.modding.WillyWonka.WillyWonkaTab;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.SoundType;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.audio.Sound;
    
    public class BlockChocolate extends Block {
    
     public BlockChocolate() {
     super(Material.ROCK);
     
     setUnlocalizedName(Reference.WillyWonkanBlocks.CHOCOLATE.getUnlocalizedName());
     setRegistryName(Reference.WillyWonkanBlocks.CHOCOLATE.getRegistryName());
     setCreativeTab(WillyWonka.CREATIVE_TAB);
     setHardness(3.0F);
     setResistance(5.0F);
     setSoundType(SoundType.STONE);
     }
    
    }


    REFERENCES:


    package com.modding.WillyWonka;
    
    public class Reference {
    
    	public static final String mod_id = "wwmod";
    	public static final String NAME = "Willy Wonka Mod";
    	public static final String VERSION = "1.0-Alpha";
    	public static final String ACCEPT_VERSIONS = "[1.11]";
    	
    	public static final String CLIENT_PROXY_CLASS = "com.modding.WillyWonka.proxy.ClientProxy";
    	public static final String SERVER_PROXY_CLASS = "com.modding.WillyWonka.proxy.ServerProxy";
    	
    	public static enum WillyWonkaItems {
    		CHOCOLATE("chocolate", "ItemChocolate"),
    		PAPER("paper", "ItemPaper"),
    		CHOCOLATE_BAR("chocolate_bar", "ItemChocolate_bar"),
    		CANDY_SWORD("candy_sword", "ItemCandy_sword");
    		
    		
    		private String unlocalizedName;
    		private String registryName;
    		
    		WillyWonkaItems(String unlocalizedName, String registryName) {
    			this.unlocalizedName = unlocalizedName;
    			this.registryName = registryName; 
    			
    		}
    			
    		public String getUnlocalizedName() {
    			return unlocalizedName;
    		}
    		
    		public String getRegistryName() {
    			return registryName;
    		}
    	}
    	
    	public static enum WillyWonkanBlocks {		
    	   CHOCOLATE("chocolate", "BlockChocolate");
    
    		
    		
    		private String unlocalizedName;
    		private String registryName;
    		
    		WillyWonkanBlocks(String unlocalizedName, String registryName) {
    			this.unlocalizedName = unlocalizedName;
    			this.registryName = registryName; 
    			
    		}
    		
    		public String getUnlocalizedName() {
    			return unlocalizedName;
    		}
    		
    		public String getRegistryName() {
    			return registryName;
    		
    		
    	}
      }
    }	
    
    



     

    CLIENTPROXY:

    package com.modding.WillyWonka.proxy;
    
    import com.modding.WillyWonka.init.ModBlocks;
    import com.modding.WillyWonka.init.ModCrafting;
    import com.modding.WillyWonka.init.ModItems;
    
    public class ClientProxy implements CommonProxy {
    
     @Override
     public void init() {
     ModItems.registerRenders();
     ModCrafting.register();
     ModBlocks.register();
    
     }
    
    }

    COMMONPROXY:

    package com.modding.WillyWonka.proxy;
    
    public interface CommonProxy {
     
     public void init();
    
    }

    POSTDATA: If you go back to 1.10.2, everything works correctly

    Posted in: Modification Development
  • To post a comment, please or register a new account.