
Godson
Members-
Posts
19 -
Joined
-
Last visited
Converted
-
Gender
Male
-
Location
In a planet called Uranus. :3
-
Personal Text
Seems legit.
Godson's Achievements

Tree Puncher (2/8)
1
Reputation
-
Oh, and there's also this glitch. http://puu.sh/7ukA3.png Vanilla slabs don't cast shadows on full blocks, while my custom slab does. Again, acting like a full block.
-
._. I just looked at the photo, and now I feel like an idiot. This is what's going on. http://puu.sh/7sc5L.png The slab doesn't stack up like normal slabs, but instead gets placed .5 blocks higher than usual. As if the slab was a full block.
-
...Huh. I didn't even notice I sent that mistake in the code. Cause that's already fixed, and it still doesn't work. ._. I'll just...repost the code...in case there are more mistakes I've already fixed from then and now. public class NegativeWoodSlabs extends BlockSlab { public static final String[] field_150005_b = new String[] {"negative"}; private static final String __OBFID = "CL_00000337"; public NegativeWoodSlabs(boolean p_i45437_1_) { super(p_i45437_1_, Material.wood); this.setCreativeTab(Mod1.tabNegative); } /** * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return Mod1.NegativeOakPlanks.getIcon(p_149691_1_, p_149691_2_ & 7); } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(Mod1.NegativeOakSlab); } /** * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. */ protected ItemStack createStackedBlock(int p_149644_1_) { return new ItemStack(Item.getItemFromBlock(Mod1.NegativeOakSlab), 2, p_149644_1_ & 7); } public String func_150002_b(int p_150002_1_) { if (p_150002_1_ < 0 || p_150002_1_ >= field_150005_b.length) { p_150002_1_ = 0; } return super.getUnlocalizedName() + "." + field_150005_b[p_150002_1_]; } /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ @SideOnly(Side.CLIENT) public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { if (p_149666_1_ != Item.getItemFromBlock(Mod1.NegativeOakSlabDouble)) { for (int i = 0; i < field_150005_b.length; ++i) { p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); } } } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) {} }
-
Sorry if bumping is against some rule or anything. But I had to. >_> Le Bump.
-
I'm starting to feel like an idiot for posting so many help threads. But there's not many places I can go to learn about 1.7's code. Well, I've created a custom slab, and it works...Kinda. Normally I'd be able to stack them up, and make them look like a full block. Instead, they do this. http://puu.sh/7pkr0.png Here's the code for the slabs. public class NegativeWoodSlabs extends BlockSlab { public static final String[] field_150005_b = new String[] {"negative"}; public NegativeWoodSlabs(boolean p_i45437_1_) { super(p_i45437_1_, Material.wood); } /** * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return Mod1.NegativeOakPlanks.getIcon(p_149691_1_, p_149691_2_ & 7); } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(Mod1.NegativeOakSlab); } /** * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. */ protected ItemStack createStackedBlock(int p_149644_1_) { return new ItemStack(Item.getItemFromBlock(Blocks.wooden_slab), 2, p_149644_1_ & 7); } public String func_150002_b(int p_150002_1_) { if (p_150002_1_ < 0 || p_150002_1_ >= field_150005_b.length) { p_150002_1_ = 0; } return super.getUnlocalizedName() + "." + field_150005_b[p_150002_1_]; } @SideOnly(Side.CLIENT) public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { if (p_149666_1_ != Item.getItemFromBlock(Mod1.NegativeOakDoubleSlab)) { for (int i = 0; i < field_150005_b.length; ++i) { p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); } } } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) {} } And the code for registering the slabs. NegativeOakSlab = new NegativeWoodSlabs(false).setHardness(2.0F).setResistance(5.0F).setCreativeTab(tabNegative).setBlockName("NegativeOakSlab"); NegativeOakDoubleSlab = new NegativeWoodSlabs(true).setHardness(2.0F).setResistance(5.0F).setCreativeTab(tabNegative).setBlockName("NegativeOakDoubleSlab"); Not sure what I'm doing wrong, everything looks fine, it's similar to vanilla's code, so I don't see the problem...
-
...What? Remove the spaces? I understand removing the spacing BEFORE the equals, but you're actually supposed to have spacing AFTER the equals, unless you want an item named "EnergyCell". ^ This. Ever since Minecraft 1.7, en_US.lang is the main way to localize system names to human-readable names. This may not be the problem, but when I register items, I do this: GameRegistry.registerItem(Item, this.Item.getUnlocalizedName().substring(5)); Just replace "Item" and "this.Item" to "cellEnergy" and "this.cellEnergy", and use that code for any items.
-
Ah, alright. I see the problem now, and I've fixed it. In case anyone wants to know what I did: I did this to keep the value of "Chance" Random random = new Random(); int Chance = random.nextInt(3); Then when the action is executed, I made it so it gives "Chance" a new value. public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } if (!par2World.isRemote && Chance == 0) { par2World.createExplosion(null, par3EntityPlayer.lastTickPosX, par3EntityPlayer.lastTickPosY, par3EntityPlayer.lastTickPosZ, 5, true); Chance = random.nextInt(3); } else if (!par2World.isRemote && Chance == 1){ par3EntityPlayer.addExperienceLevel(3); par3EntityPlayer.addChatMessage(new ChatComponentTranslation("msg.Unstable_Levels.txt")); Chance = random.nextInt(3); } else if (!par2World.isRemote && Chance == 2) { par3EntityPlayer.addChatMessage(new ChatComponentTranslation("msg.Unstable_NothingMessage.txt")); Chance = random.nextInt(3); } return par1ItemStack; } Thanks for pointing out my mistake, GotoLink. I didn't really notice it too much.
-
So I have a custom item that's a bit similar to the Lucky Blocks mod or the Pandora's Box mod, however my item has more bad outcomes than it does good outcomes, and the mod isn't solely based on that single item. Anyways, I got a working randomizing method by registering "Chance" as Random. And then I used Chance.nextInt(3) == 0 to check for the first number. According to what I've learned in Java, nextInt(int n) checks from 0 and the number I specified, except it excludes that number and just leaves the number before that. So after filling in all three checks, I've got it to randomly do one of three things, however, there is a random chance that it does absolutely nothing. Here's the Item's code so you can see what I've done, and maybe with that you can point out my mistake? public class ItemUnstableEssence extends Item { public ItemUnstableEssence() { super(); setMaxStackSize(64); setCreativeTab(Mod1.tabNegative); } @SideOnly(Side.CLIENT) public boolean hasEffect(ItemStack par1ItemStack) { return true; } Random Chance = new Random(); @SideOnly(Side.CLIENT) public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add("The unstable power of Positive and Negative"); par3List.add("essences fused into this essence."); par3List.add("Be warned, this unstable power can have"); par3List.add("positive or negative effects."); } public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par3EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } if (!par2World.isRemote && Chance.nextInt(3) == 0) { par2World.createExplosion(null, par3EntityPlayer.lastTickPosX, par3EntityPlayer.lastTickPosY, par3EntityPlayer.lastTickPosZ, 5, true); } else if (!par2World.isRemote && Chance.nextInt(3) == 1){ par3EntityPlayer.addExperienceLevel(3); } else if (!par2World.isRemote && Chance.nextInt(3) == 2) { par3EntityPlayer.addChatMessage(new ChatComponentTranslation("msg.Unstable_NothingMessage.txt")); } return par1ItemStack; } }
-
This is with Forge 6.5.0.471 in mind. Last I remembered, Forge updated to 10.12.0.1039 for Minecraft 1.7, meaning this most of this code will return with errors, even if this tutorial was updated to 9.10.x. Here's a neat tutorial I used to help update my code from 1.6 to 1.7, it'll help you make a new achievement from scratch.
-
[1.7.2] [SOLVED] Custom Sapling won't grow on custom blocks
Godson replied to Godson's topic in Modder Support
So I fixed the problem, except with the fact vanilla saplings also grow on my custom dirt/grass. Though it doesn't really matter much to me. Thanks for helping out. -
[1.7.2] [SOLVED] Custom Sapling won't grow on custom blocks
Godson replied to Godson's topic in Modder Support
(Not sure if okay to bump, so I apologize if I've done something wrong by bumping.) I've been screwing around with the code, and still no luck with my custom sapling growing on my custom blocks. I can place them on the custom blocks now, but they won't grow, I've been spamming bonemeal on it every time I make a change. -
[1.7.2] [SOLVED] Custom Sapling won't grow on custom blocks
Godson replied to Godson's topic in Modder Support
Okay, so I've kinda fixed it, and now it can be placed on both vanilla dirt and my custom dirt...It just won't grow on the custom dirt. Here's my ModBush class if that helps. public class ModBush extends BlockBush implements IPlantable { protected ModBush(Material p_i45395_1_) { super(p_i45395_1_); this.setTickRandomly(true); float f = 0.2F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3.0F, 0.5F + f); this.setCreativeTab(CreativeTabs.tabDecorations); } protected ModBush() { this(Material.plants); } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) { return super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.canBlockStay(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); } /** * is the block grass, dirt or farmland */ @Override protected boolean canPlaceBlockOn(Block p_149854_1_) { return p_149854_1_ == Blocks.grass || p_149854_1_ == Blocks.dirt || p_149854_1_ == Blocks.farmland || p_149854_1_ == Mod1.NegativeGrass || p_149854_1_ == Mod1.NegativeDirt; } /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor Block */ public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) { super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_); this.checkAndDropBlock(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_); } /** * Ticks the block if it's been scheduled */ public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { this.checkAndDropBlock(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); } /** * checks if the block can stay, if not drop as item */ protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_) { if (!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_)) { this.dropBlockAsItem(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_, p_149855_1_.getBlockMetadata(p_149855_2_, p_149855_3_, p_149855_4_), 0); p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, getBlockById(0), 0, 2); } } /** * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. */ public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) { return p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_).canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this); } /** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } /** * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } /** * The type of render function that is called for this block */ public int getRenderType() { return 1; } @Override public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) { if (this == Blocks.wheat) return Crop; if (this == Blocks.carrots) return Crop; if (this == Blocks.potatoes) return Crop; if (this == Blocks.melon_stem) return Crop; if (this == Blocks.pumpkin_stem) return Crop; if (this == Blocks.waterlily) return Water; if (this == Blocks.red_mushroom) return Cave; if (this == Blocks.brown_mushroom) return Cave; if (this == Blocks.nether_wart) return Nether; if (this == Blocks.sapling) return Plains; return Plains; } @Override public Block getPlant(IBlockAccess world, int x, int y, int z) { return this; } @Override public int getPlantMetadata(IBlockAccess world, int x, int y, int z) { return world.getBlockMetadata(x, y, z); } } -
[1.7.2] [SOLVED] Custom Sapling won't grow on custom blocks
Godson replied to Godson's topic in Modder Support
Override the method as in adding @Override to the line of code I showed earlier? Or override as in something else I don't know...? I've added @Override and line of code returns with an error. "The method canPlaceBlockOn(Block) of type ModBush must override or implement a supertype method" And then tells me to remove @Override, is there something I'm doing wrong? -
I thought I could figure this out by myself or by googling, but I've spent about a day and a half trying to figure this out. So here I go... I've successfully made a custom sapling that grows a custom tree, and also works with vanilla bonemeal. Everything's working perfectly, however, I want this custom sapling to work with my custom dirt and grass just like it does with vanilla dirt and grass. I've tried copying the BlockBush file and modified this line of code. /** * is the block grass, dirt or farmland */ protected boolean canPlaceBlockOn(Block p_149854_1_) { return p_149854_1_ == Blocks.grass || p_149854_1_ == Blocks.dirt || p_149854_1_ == Blocks.farmland || p_149854_1_ == Mod1.NegativeGrass || p_149854_1_ == Mod1.NegativeDirt; } Then I made my custom sapling extend this file, but it still works on vanilla blocks, and not my custom blocks. Do I have to modify the blocks to sustain the custom sapling? Or is there something I have to add to the sapling to be sustained in the custom blocks? Thanks in advance.
-
Sometimes textures will glitch out in Forge 10.12.0.1034. And fail to load, what you need to do is add a line a code until forge updates. /** TODO Hack to get our textures for items and blocks to show, remove when the bug is * fixed in an update. If this is not done, then the player must manually refresh * the texture packs. */ if (event.getSide() == Side.CLIENT) Minecraft.getMinecraft().refreshResources(); Post that in the FMLPreInt event, and the resources should refresh and your textures should load, works fine for me.