Jump to content

Glorfindel22

Members
  • Posts

    43
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • URL
    http://www.minecraftforum.net/topic/1983421-172-forge-recipe-expansion-pack-version-012/
  • Personal Text
    Modder-In-Training

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Glorfindel22's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Thanks that fixed my issue. I am updating to 1.8.9 by the way, sorry I wasn't more clear about that.
  2. I am working on updating my mod to 1.8 and I am trying to switch to using ItemBlocks as it looks like it will be required to update to 1.9. I managed to get it mostly working, but I am still confused about a few things and can't find much information online. So here is what I have: The ItemBlock public class ItemBlockMortarAndPestle extends ItemBlock { public ItemBlockMortarAndPestle(Block block) { super(block); this.maxStackSize = 1; this.setUnlocalizedName("mortarAndPestle"); this.setCreativeTab(CoffeeAndTeaMod.teaTab); } } The Block public class BlockMortarAndPestle extends Block { public static final IProperty<EnumFacing> DIRECTION = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public BlockMortarAndPestle() { super(Material.rock); this.setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.495F, 0.8F); this.setCreativeTab(CoffeeAndTeaMod.teaTab); this.setDefaultState(blockState.getBaseState().withProperty(DIRECTION, EnumFacing.NORTH)); this.setHardness(5.0F); this.setHarvestLevel("pickaxe", 1); } @Override public boolean isOpaqueCube() { return false; } @Override public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT; } @Override public BlockState createBlockState() { return new BlockState(this, DIRECTION); } @Override public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(DIRECTION)).getIndex(); } @Override public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(DIRECTION, enumfacing); } @Override /** * Called when a player places the block and is what is used to set direction */ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(DIRECTION, placer.getHorizontalFacing().getOpposite()); } } Then I register it like this: mortarAndPestle = new BlockMortarAndPestle().setUnlocalizedName("mortarAndPestle"); GameRegistry.registerBlock(mortarAndPestle, ItemBlockMortarAndPestle.class, "mortarAndPestle"); So the block itself works perfectly fine and the model shows up when I place it however, there is no item model. It is just a the missing texture image. Which doesn't make sense to me because I have a file named mortarAndPestle.json in assets/teamod/models/item: { "parent": "builtin/generated", "textures": { "layer0": "teamod:items/mortarAndPestle" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0 ], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } } So my question is: how do I set an item model for an ItemBlock? Is it any different than normal?
  3. Thanks that fixed everything. My code for future reference. package net.richardsprojects.teamod.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.richardsprojects.teamod.CoffeeAndTeaMod; public class BlockEmptyCup extends Block { public static final IProperty<EnumFacing> DIRECTION = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public BlockEmptyCup() { super(Material.wood); this.setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.495F, 0.8F); this.setCreativeTab(CoffeeAndTeaMod.teaTab); this.setDefaultState(blockState.getBaseState().withProperty(DIRECTION, EnumFacing.NORTH)); } @Override public boolean isOpaqueCube() { return false; } @Override public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT; } @Override public BlockState createBlockState() { return new BlockState(this, DIRECTION); } @Override public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(DIRECTION)).getIndex(); } @Override public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(DIRECTION, enumfacing); } @Override /** * Called when a player places the block and is what is used to set direction */ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(DIRECTION, placer.getHorizontalFacing().getOpposite()); } }
  4. I am working on trying to update my 1.7.10 mod to Minecraft 1.8.9 and I am trying to use the json modelling system to implement the different facing directions in my blocks. My block originally worked fine before I attempted this but now I have messed it up and I can no longer place the block. I tried following the Intro to Blockstates guide on Read The Docs and I looked at the BlockFurnace vanilla code, but there must still be something I am missing. Here is what I have so far. BlockEmptyCup.java package net.richardsprojects.teamod.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.richardsprojects.teamod.CoffeeAndTeaMod; public class BlockEmptyCup extends Block { public static final IProperty<EnumFacing> DIRECTION = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public BlockEmptyCup() { super(Material.wood); this.setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.495F, 0.8F); this.setCreativeTab(CoffeeAndTeaMod.teaTab); this.setDefaultState(new BlockState(this, DIRECTION).getBaseState().withProperty(DIRECTION, EnumFacing.NORTH)); } @Override public boolean isOpaqueCube() { return false; } @Override public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT; } @Override public BlockState createBlockState() { return new BlockState(this, DIRECTION); } @Override public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(DIRECTION)).getIndex(); } @Override public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(DIRECTION, enumfacing); } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { Block block = worldIn.getBlockState(pos.north()).getBlock(); Block block1 = worldIn.getBlockState(pos.south()).getBlock(); Block block2 = worldIn.getBlockState(pos.west()).getBlock(); Block block3 = worldIn.getBlockState(pos.east()).getBlock(); EnumFacing enumfacing = (EnumFacing)state.getValue(DIRECTION); if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock()) { enumfacing = EnumFacing.WEST; } worldIn.setBlockState(pos, state.withProperty(DIRECTION, enumfacing), 2); } } } emptyCup.json { "variants": { "facing=north": { "model": "teamod:emptyCup" }, "facing=south": { "model": "teamod:emptyCup", "y": 180 }, "facing=west": { "model": "teamod:emptyCup", "y": 270 }, "facing=east": { "model": "teamod:emptyCup", "y": 90 } } } Thanks for any help!
  5. I am working on an update to my Coffee and Tea Mod and I recently was able to get it so that so that Coffee and Tea Bushes spawn naturally through out the world with terrain generation. However, now I would like to see if it is possible to spawn my custom crops in the villager farms. Any ideas? My code is available on GitHub here: https://github.com/RichardsProjects/Richard-s-Coffee-And-Tea-Mod
  6. That worked and with some tweaking I managed to get a result that I was pleased with. If anyone would like to see my code it's available here: https://www.github.com/RichardsProjects/Richard-s-Coffee-And-Tea-Mod
  7. I released my mod the Coffee and Tea Mod a few months ago. And I am currently working on an update to the mod right now. The Tea Mod adds Coffee and Tea Bushes, but I want to figure out how to have spawn them radomly in specific biomes naturally. However, I have never done any Terrain Generation before so I do not really no where to start. Any advice or help would be greatly appreciated.
  8. I figured it out. I needed to set the material to Material.plants. I'll leave this here for future reference.
  9. I am working on updating my Coffee & Tea Mod and I am trying to fix a bug that has been in it for a while. Basically whenever the farmland underneath my custom crop (technically a coffee bush) has a block update it turns to dirt. I have no idea how to fix this and it is really weird. Here is the code to my Coffee Bush. package net.richardsprojects.teamod.main; //Removed the imports to shorten the code here public class BlockCoffeeBush extends BlockContainer implements IGrowable { protected BlockCoffeeBush(Material mat) { super(mat); this.setTickRandomly(true); float f = 0.5F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); this.setCreativeTab((CreativeTabs)null); this.setHardness(0.0F); this.setStepSound(soundTypeGrass); this.disableStats(); } public static void mainRegistry() { initializeBlock(); registerBlock(); } //Used to handle crops growing public void updateTick(World world, int x, int y, int z, Random random) { if (world.getBlockLightValue(x, y + 1, z) >= 9) { int metadata = world.getBlockMetadata(x, y, z); if (metadata < 7) { if (random.nextInt(2) == 0) { metadata++; world.setBlockMetadataWithNotify(x, y, z, metadata, 2); } } } } public static Block coffeeBush; public static void initializeBlock() { coffeeBush = new BlockCoffeeBush(Material.grass).setBlockName("coffeeBush").setBlockTextureName("teamod:CoffeeStage1_4"); } public static void registerBlock() { GameRegistry.registerBlock(coffeeBush, coffeeBush.getUnlocalizedName()); } //Set the TileEntity @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new CoffeeBushEntity(); } //Can be grown on farmland, dirt, or grass protected boolean canPlaceBlockOn(Block block) { return block == Blocks.farmland; } //Not a normal renderType @Override public int getRenderType() { return -1; } //It's not an opaque cube @Override public boolean isOpaqueCube() { return false; } //It's not a normal block public boolean renderAsNormalBlock() { return false; } //Returns whether its fully grown? @Override public boolean func_149851_a(World world, int x, int y, int z, boolean flag) { return world.getBlockMetadata(x, y, z) != 7; } //I have no idea what this is for. @Override public boolean func_149852_a(World world, Random random, int x, int y, int z) { return true; } //Handles Bonemeal @Override public void func_149853_b(World world, Random random, int x, int y, int z) { int metadata = 0; metadata = world.getBlockMetadata(x, y, z) + MathHelper.getRandomIntegerInRange(world.rand, 2, 5); if (metadata > 7) { metadata = 7; } world.setBlockMetadataWithNotify(x, y, z, metadata, 2); } protected Item func_149865_P() { return null; } /** * Gets an item for the block being called on. Args: world, x, y, z */ @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return this.func_149866_i(); } /** * Returns the quantity of items to drop on block destruction. */ @Override public int quantityDropped(Random p_149745_1_) { return 0; } /** * Gets an item for the block being called on. Args: world, x, y, z */ //TODO: Don't know if this needs to be only client side or not @SideOnly(Side.CLIENT) public Item getItemDropped(int p_149650_1_, Random rnd, int p_149650_3_) { return null; } protected Item func_149866_i() { return ItemCoffeeBeans.unroastedBean; } }[/Code] It may seem a bit odd because it is also a TileEntity so that it can display different 3d models for each stage. Any help would be greatly appreciated. I am trying to get this update out as quickly as possible (everything else is finished). TIA
  10. Actually I just realized the problem. So I figured I would just post this for future reference. The issue is right here: //Code to check stage of Wheat if(par3World.getBlock(par4, par5, par6) == Blocks.wheat && par2EntityPlayer.worldObj.isRemote) { Apparently durability damage must be done client side so it should be this: //Code to check stage of Wheat if(par3World.getBlock(par4, par5, par6) == Blocks.wheat && !par2EntityPlayer.worldObj.isRemote) {
  11. I am working on an update to my mod the Recipe Expansion Pack and I am having trouble making the plant book take durability when used (right clicked). I am writing my code inside of the "onItemUse" method. The issue is when I use it on wheat the first time the durability goes from 64/64 to 63/64 but then goes back up to 64/64 again when I use it the second time. This continues in a never ending loop each time I right click it resulting in the durability never going below 63. Here is my code: public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { //Code to check stage of Wheat if(par3World.getBlock(par4, par5, par6) == Blocks.wheat && par2EntityPlayer.worldObj.isRemote) { String text = "Wheat (Stage " + (par3World.getBlockMetadata(par4, par5, par6)); if((par3World.getBlockMetadata(par4, par5, par6) == 7)) { text = text + " - \"Mature\""; } text = text + ")"; if(!text.equals("")) { par2EntityPlayer.addChatComponentMessage(new ChatComponentText(text)); if(!par2EntityPlayer.capabilities.isCreativeMode) { par1ItemStack.damageItem(1, par2EntityPlayer); } } } }[/Code] Any help with this would be greatly appreciated, as it seems very odd and has confused me for quite some time.
  12. I recently released a mod called the Coffee & Tea Mod and I am currently doing a few fixes for it. The cups that you place on the ground are Items, but I use an event to detect that when the player right clicks with them on the ground so that they place the block versions. Thus, I need to make it so that when a player uses the "pick block" ability in Creative they receive the item not the block. I assume I add an override method to the block class? Any help? TIA.
  13. I need to create a custom tree as I am trying to create a coffee tree. I have no idea where to start because I can't see the code of Minecraft to base it off of in 1.7.10. I already have the seed item for it and made it from the grass by registering it. But I assume I need to at least create the sapling block, the wood block, and the leaf block. Are there any other files I would need to create and how would this all work? Any help would be greatly appreciated.
  14. So you aren't running the server to test it in forge? If that's the case I fail to see why you need to get to login through eclipse because you are going to have to wait for the other person to update the forge mod running on that server or it will kick you because they won't match. Aren't you at least running the server in eclipse for testing it? If that's the case you can change the properties and you won't need to do it in the future only on the test server why you aren't logged in with a valid minecraft account.
×
×
  • Create New...

Important Information

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