Jump to content

wrink

Members
  • Posts

    15
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

wrink's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm working on a fluid that has 3 important ints to store that determine everything the fluid does when stepped it, used by a machine or consumed. I'm about a quarter of the way through the project and all the fluids have already been included, each one with its own individual block, fluid, bucket and bottle. Am I doing this the stupid way? Is this going to end up biting me in the butt at some point?
  2. okay, on further inspection I noticed that I forgot the @SubscribeEvent at the top of fill bucket. Now when I try to fill the bucket, the game crashes because of something to do with a ticking entity and the itemstack update animation
  3. When I try to fill my bucket, it just fills with water. I've followed the instructions from scratchforfun's tutorials, but they haven't solved this issue @EventHandler public void PreInit(FMLPreInitializationEvent event) { makeTonic(blockTonic, fluidTonic, bucketTonic, bottleTonic, "tonic", 0, 0); MinecraftForge.EVENT_BUS.register(new FillContainerEvent()); } public void makeTonic(Block block, Fluid fluid, Item bucket, Item bottle, String name, int id, int amp) { fluid = new FluidTonic(name, id, amp).setBlock(block); FluidRegistry.registerFluid(fluid); block = new BlockTonic(fluid, 0, 0).setBlockName("block_"+name); GameRegistry.registerBlock(block, "block_"+name); bucket = new ItemBucket(block).setUnlocalizedName(name+"_bucket").setMaxStackSize(1).setContainerItem(Items.bucket).setCreativeTab(tab); FluidContainerRegistry.registerFluidContainer(fluid, new ItemStack(bucket), new ItemStack(Items.bucket)); GameRegistry.registerItem(bucket, "bucket"+name); FillContainerEvent.INSTANCE.buckets.put(block, bucket); //FluidContainerRegistry.registerFluidContainer(new FluidStack(fluid, 500), new ItemStack(bottle), new ItemStack(Items.glass_bottle)); } public class FillContainerEvent { public static FillContainerEvent INSTANCE = new FillContainerEvent(); public Map<Block, Item> buckets = new HashMap<Block, Item>(); public Map<Block, Item> bottles = new HashMap<Block, Item>(); public void fillBucket(FillBucketEvent e) { if(e.current.getItem() != Items.bucket) { return; } ItemStack fullBucket = getLiquid(e.world, e.target); if (fullBucket == null) return; e.world.setBlockToAir(e.target.blockX, e.target.blockY, e.target.blockZ); e.result = fullBucket; e.setResult(Result.ALLOW); } private ItemStack getLiquid(World world, MovingObjectPosition pos) { Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ); return new ItemStack(buckets.get(block)); } }
  4. So right now I'm working on a mod that adds a simplified replacement for the vanilla potion system which involves fluids called tonics and several machines that use them. I've run into a problem in that the tonic system obviously needs the enhanced and extended versions of the tonics. I don't know how to implement them though because it seems really inefficient to hard code every version of every potion and to be quite honest I don't know if I should be using metadata or nbt tags or something
  5. I'm noticing that when the upon spawning in the world, a player may only be affected by a continuous potion once. thereafter it does nothing
  6. hi, I'm making a mod that creates liquid version of the standard potions. When a player wades in a block of potion liquid, they should gain the potion effect. This is not taking place. I don't know why the potion effects don't work. here's my code: package wrink.liquidPotions.fluids; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.potion.PotionEffect; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidBase; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; public abstract class IBlockPotion extends BlockFluidClassic { private PotionEffect effect=null; public IBlockPotion(Fluid fluid, Material material) { super(fluid, material); setTickRandomly(true); } @Override public void onEntityWalking(World world, int x, int y, int z, Entity entity) { PotionEffect effect = this.getPotionEffect(); if(!(effect==null) && entity instanceof EntityLivingBase) { ((EntityLivingBase) entity).addPotionEffect(effect); } } private PotionEffect getPotionEffect() { return effect; } public IBlockPotion setPotionEffect(PotionEffect effect) { Block copy = this; this.effect=effect; return this; } } blockPotionFluidAwkward = new BlockPotionBase(fluidPotionAwkward, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion"); blockPotionFluidThick = new BlockPotionBase(fluidPotionThick, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion"); blockPotionFluidMundane = new BlockPotionBase(fluidPotionMundane, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion"); blockPotionFluidMundane_plus = new BlockPotionBase(fluidPotionMundane_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion"); blockPotionFluidBreath = ((IBlockPotion) new BlockPotionBase(fluidPotionBreath, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(13, 0, 1)); blockPotionFluidBreath_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionBreath_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(13, 3600, 1)); blockPotionFluidFire = ((IBlockPotion) new BlockPotionBase(fluidPotionFire, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(12, 0, 1)); blockPotionFluidFire_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionFire_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(12, 3600, 1)); blockPotionFluidSlow = ((IBlockPotion) new BlockPotionBase(fluidPotionSlow, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(2, 0, 1)); blockPotionFluidSlow_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionSlow_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(2, 1800, 1)); blockPotionFluidSwift = ((IBlockPotion) new BlockPotionBase(fluidPotionSwift, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(1, 0, 1)); blockPotionFluidSwift_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionSwift_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(1, 3600, 1)); blockPotionFluidSwift_II = ((IBlockPotion) new BlockPotionBase(fluidPotionSwift_II, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(1, 0, 2)); blockPotionFluidHeal = ((IBlockPotion) new BlockPotionBase(fluidPotionHeal, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(6, 0, 1)); blockPotionFluidHeal_II = ((IBlockPotion) new BlockPotionBase(fluidPotionHeal_II, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(6, 0, 2)); blockPotionFluidHarm = ((IBlockPotion) new BlockPotionBase(fluidPotionHarm, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(7, 0, 1)); blockPotionFluidHarm_II = ((IBlockPotion) new BlockPotionBase(fluidPotionHarm_II, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(7, 0, 2)); blockPotionFluidPoison = ((IBlockPotion) new BlockPotionBase(fluidPotionPoison, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(19, 0, 1)); blockPotionFluidPoison_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionPoison_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(19, 900, 1)); blockPotionFluidPoison_II = ((IBlockPotion) new BlockPotionBase(fluidPotionPoison_II, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(19, 0, 2)); blockPotionFluidSee = ((IBlockPotion) new BlockPotionBase(fluidPotionSee, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(16, 0, 1)); blockPotionFluidSee_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionSee_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(16, 3600, 1)); blockPotionFluidInvis = ((IBlockPotion) new BlockPotionBase(fluidPotionInvis, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(14, 0, 1)); blockPotionFluidInvis_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionInvis_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(14, 3600, 1)); blockPotionFluidRegen = ((IBlockPotion) new BlockPotionBase(fluidPotionRegen, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(10, 0, 1)); blockPotionFluidRegen_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionRegen_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(10, 900, 1)); blockPotionFluidRegen_II = ((IBlockPotion) new BlockPotionBase(fluidPotionRegen_II, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(10, 0, 2)); blockPotionFluidWeak = ((IBlockPotion) new BlockPotionBase(fluidPotionWeak, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(18, 0, 1)); blockPotionFluidWeak_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionWeak_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(18, 1800, 1)); blockPotionFluidStrong = ((IBlockPotion) new BlockPotionBase(fluidPotionStrong, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(5, 0, 1)); blockPotionFluidStrong_plus = ((IBlockPotion) new BlockPotionBase(fluidPotionStrong_plus, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(5, 3600, 1)); blockPotionFluidStrong_II = ((IBlockPotion) new BlockPotionBase(fluidPotionStrong_II, Material.water).setBlockTextureName("liquidPotions" + ":" + "fluidPotion")).setPotionEffect(new PotionEffect(5, 0, 2)); bucketPotionAwkward = new ItemBucket(blockPotionFluidAwkward).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionAwkward"); bucketPotionThick = new ItemBucket(blockPotionFluidThick).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionThick"); bucketPotionMundane = new ItemBucket(blockPotionFluidMundane).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionMundane"); bucketPotionMundane_plus = new ItemBucket(blockPotionFluidMundane_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionMundane_plus"); bucketPotionBreath = new ItemBucket(blockPotionFluidBreath).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionBreath"); bucketPotionBreath_plus = new ItemBucket(blockPotionFluidBreath_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionBreath_plus"); bucketPotionFire = new ItemBucket(blockPotionFluidFire).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionFire"); bucketPotionFire_plus = new ItemBucket(blockPotionFluidFire_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionFire_plus"); bucketPotionSlow = new ItemBucket(blockPotionFluidSlow).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionSlow"); bucketPotionSlow_plus = new ItemBucket(blockPotionFluidSlow_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionSlow_plus"); bucketPotionSwift = new ItemBucket(blockPotionFluidSwift).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionSwift"); bucketPotionSwift_plus = new ItemBucket(blockPotionFluidSwift_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionSwift_plus"); bucketPotionSwift_II = new ItemBucket(blockPotionFluidSwift_II).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionSwift_II"); bucketPotionHeal = new ItemBucket(blockPotionFluidHeal).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionHeal"); bucketPotionHeal_II = new ItemBucket(blockPotionFluidHeal_II).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionHeal_II"); bucketPotionHarm = new ItemBucket(blockPotionFluidHarm).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionHarm"); bucketPotionHarm_II = new ItemBucket(blockPotionFluidHarm_II).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionHarm_II"); bucketPotionPoison = new ItemBucket(blockPotionFluidPoison).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionPoison"); bucketPotionPoison_plus = new ItemBucket(blockPotionFluidPoison_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionPoison_plus"); bucketPotionPoison_II = new ItemBucket(blockPotionFluidPoison_II).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionPoison_II"); bucketPotionSee = new ItemBucket(blockPotionFluidSee).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionSee"); bucketPotionSee_plus = new ItemBucket(blockPotionFluidSee_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionSee_plus"); bucketPotionInvis = new ItemBucket(blockPotionFluidInvis).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionInvis"); bucketPotionInvis_plus = new ItemBucket(blockPotionFluidInvis_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionInvis_plus"); bucketPotionRegen = new ItemBucket(blockPotionFluidRegen).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionRegen"); bucketPotionRegen_plus = new ItemBucket(blockPotionFluidRegen_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionRegen_plus"); bucketPotionRegen_II = new ItemBucket(blockPotionFluidRegen_II).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionRegen_II"); bucketPotionWeak = new ItemBucket(blockPotionFluidWeak).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionWeak"); bucketPotionWeak_plus = new ItemBucket(blockPotionFluidWeak_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionWeak_plus"); bucketPotionStrong = new ItemBucket(blockPotionFluidStrong).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionStrong"); bucketPotionStrong_plus = new ItemBucket(blockPotionFluidStrong_plus).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionStrong_plus"); bucketPotionStrong_II = new ItemBucket(blockPotionFluidStrong_II).setMaxStackSize(1).setContainerItem(new ItemBucket(Blocks.air)).setCreativeTab(CreativeTabs.tabBrewing).setUnlocalizedName("BucketPotionStrong_II");
  7. I need to make it so that when a player steps in a liquid, they have a regeneration effect on them for as long as they stay in the liquid. I've been wading through the source code of both vanilla minecraft and thermal expansion for half an hour trying to figure out how to get all the entities within a liquid block. so far I've had no luck
  8. Okay, question: One of the upgrades I want to add to my armor is a pocket computer from computercraft 1.6 that is built into the helmet. the computer would always be on (unless shut down manually or the helmet is taken off) but displayed only at the press of a hotkey. because the functions in computercraft are named in numbers and not words, I'm having a difficult time understanding how to tell the computer to turn on and off under certain circumstances.
  9. For the mod I'm working on, there are a few features I need to implement that I don't quite know how to code due to the fact that I'm still new to all of this. Some I think are simpler than others. I figure it would be better to create one topic than to create one for each question. Right now, here are a few features I'm not sure how to implement *Armor-assisted flight *Shoes that decrease fall damage and allow the user to step up further than .5m *Armor-generated lighting
  10. but it's a multiblock. how would I add different names for different metadata? Also, I changed my code and now all the blocks I added have the proper names except for redstone cloth, which is still blackstone cloth. apparently I typed GameRegistry.registerBlock(redstoneCloth, "redstoneCloth"); instead of GameRegistry.registerBlock(redstoneCloth, RedstoneClothItem.class);
  11. By the way, I don't know how to use a .lang file. I'm just starting out and barely know anything
  12. Is there a good tool for making models and textures to use in my minecraft mod on a mac? I've tried using blender but it seems ridiculously complicated. is there a better tool?
  13. Sorry... but he is already creating a new instance of the ItemStack in each iteration of the loop, that is not the answer (it would be if he wasn't). @OP: Can you post your Block or Item code? I'm guessing your issue is you forgot to designate an ItemBlockWithMetadata or return appropriately distinct unlocalized names for each stack. Check here for an example of a block with subtypes. Using that your language registry will work just fine as it is. package wrink.dappercraft; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; public class RedstoneClothItem extends ItemBlock { public RedstoneClothItem(int par1) { super(par1); this.setMaxDamage(0); this.setHasSubtypes(true); } @SideOnly(Side.CLIENT) /** * Gets an icon index based on an item's damage value */ public Icon getIconFromDamage(int par1) { return Block.cloth.getIcon(2, BlockColored.getBlockFromDye(par1)); } /** * Returns the metadata of the block which this Item (ItemBlock) can place */ public int getMetadata(int par1) { return par1; } @Override /** * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have * different names based on their damage or NBT. */ public String getUnlocalizedName(ItemStack par1ItemStack) { return super.getUnlocalizedName() + "." + ItemDye.dyeColorNames[RedstoneCloth.getBlockFromDye(par1ItemStack.getItemDamage())]; } } package wrink.dappercraft; import java.util.List; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraft.world.World; public class RedstoneCloth extends ClothBlock { private Icon[] iconArray; public RedstoneCloth(int par1, Material par2Material) { super(par1, par2Material); setUnlocalizedName("redCloth").setTextureName("dappercraft:redstoneCloth").setCreativeTab(CreativeTabs.tabBlock); } @SideOnly(Side.CLIENT) /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata */ public Icon getIcon(int par1, int par2) { return this.iconArray[par2 % this.iconArray.length]; } /** * Determines the damage on the item the block drops. Used in cloth and wood. */ public int damageDropped(int par1) { return par1; } /** * Takes a dye damage value and returns the block damage value to match */ public static int getBlockFromDye(int par0) { return ~par0 & 15; } /** * Takes a block damage value and returns the dye damage value to match */ public static int getDyeFromBlock(int par0) { return ~par0 & 15; } @SideOnly(Side.CLIENT) /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { for (int j = 0; j < 16; ++j) { par3List.add(new ItemStack(par1, 1, j)); } } @SideOnly(Side.CLIENT) /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ public void registerIcons(IconRegister par1IconRegister) { this.iconArray = new Icon[16]; for (int i = 0; i < this.iconArray.length; ++i) { this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_" + ItemDye.dyeItemNames[getDyeFromBlock(i)]); } } @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random random) { float f1 = (float)x+.5f; float f2 = (float)y+1.1f; float f3 = (float)z+.5f; float f4 = random.nextFloat()*1.4f-.7f; float f5 = (random.nextFloat()*-1.4f+.7f); world.spawnParticle("reddust", (double) f1+f4, f2, f3+f5, 0, 0, 0); } }
  14. In addition, I seem to be unable to to create shapeless recipes for the different colors of redstone cloth.
  15. I'm having a problem where a bunch of subblocks that are essentially different colors of wool are all coming up in the creative tab with the name "Blackstone Cloth". I'm not quite sure how to resolve this matter, as firmly ordering my code to work hasn't helped private final static String[] subNames = { "White", "Orange", "Magenta", "Light Blue", "Yellow", "Lime Green", "Pink", "Grey", "Light Grey", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black" }; public void preInit(FMLPreInitializationEvent event) { // Stub Method GameRegistry.registerBlock(redstoneCloth, "redstoneCloth"); for (int ix = 0; ix < 16; ix++) { ItemStack oldRedCloth = new ItemStack(redstoneCloth, 1); ItemStack dye = new ItemStack(Item.dyePowder, 1, ix); ItemStack redCloth = new ItemStack(redstoneCloth, 1, ix); GameRegistry.addShapelessRecipe(redCloth, oldRedCloth, dye); LanguageRegistry.addName(redCloth, subNames[ix]+"stone Cloth"); } }
×
×
  • Create New...

Important Information

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