Jump to content

dualinfinities

Members
  • Posts

    16
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am a moron.

dualinfinities's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. d'oh. accurate profile blurb is accurate. that's way simpler than the stupid way I was trying to do, thanks for helping me.
  2. The full class, if that helps at all: package com.dualinfinities.DIOres.block; import com.dualinfinities.DIOres.reference.DIOreRegistry; import com.dualinfinities.DIOres.reference.Names; import com.dualinfinities.DIOres.reference.Reference; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.world.World; public class BlockDIOre extends Block { public String ore; public int density; public Block baseBlock; DIOreRegistry registry = new DIOreRegistry(); Names nameClass = new Names(); public BlockDIOre(Material material){ super(material); } public BlockDIOre(String ore, int miningLevel, String miningTool, int oreStyle, int density, Block baseBlock){ this(baseBlock.getMaterial()); this.setCreativeTab(CreativeTabs.tabBlock); this.setBlockName(nameClass.translateValuesToString(this)); this.setDensity(density); this.setOre(ore); this.setBaseBlock(baseBlock); /** * valid tool values are "pickaxe", "shovel", "axe" * */ this.setHarvestLevel(miningTool, miningLevel); this.addToOreMap(this, ore); this.addToDensityMap(this, density); this.addToBaseMap(this, baseBlock); } @Override public String getUnlocalizedName() { return String.format("tile.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()))); } protected String getUnwrappedUnlocalizedName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } @Override public void breakBlock(World world, int x, int y, int z, Block block, int meta) { if (meta < 15) { world.setBlock(x, y, z, this, meta + 1, 0); } else if (meta == 15) { world.setBlock(x, y, z, getNextBlock((BlockDIOre) block), 0, 0); } } public Block getNextBlock(BlockDIOre inputBlock) { Block outputBlock = null; if (registry.densityMap.get(inputBlock) != 0) { for (BlockDIOre currentOre : registry.oreMap.keySet()) { for (BlockDIOre currentOre1 : registry.densityMap.keySet()) { for (BlockDIOre currentOre2 : registry.baseBlockMap.keySet()) { if (getOre(currentOre).equals(getOre(inputBlock)) && getDensity(currentOre1) == getDensity(inputBlock) - 1 && getBaseBlock(currentOre2) == getBaseBlock(inputBlock) && currentOre == currentOre1 && currentOre1 == currentOre2) { outputBlock = currentOre; } } } } } else outputBlock = registry.baseBlockMap.get(inputBlock); return outputBlock; } public int getDensity(BlockDIOre oreToGet){ return registry.densityMap.get(oreToGet); } public void setDensity(int densityToSet) { this.density = densityToSet; } public String getOre(BlockDIOre oreToGet){ return registry.oreMap.get(oreToGet); } public void setOre(String oreToSet) { this.ore = oreToSet; } public Block getBaseBlock(BlockDIOre baseBlockToGet){ return registry.baseBlockMap.get(baseBlockToGet); } public void setBaseBlock(Block baseBlockToSet) { this.baseBlock = baseBlockToSet; } /** * NYI * */ public void addToOreMap(BlockDIOre blockOre, String ore) { } public void addToDensityMap(BlockDIOre blockOre, int density) { } public void addToBaseMap(BlockDIOre blockOre, Block baseBlock) { } }
  3. Kinda... Also density? But separate from the density value. I added "= null" to initialize outputBlock, was that really all it was? maybe it had an issue because there wasn't an "else" condition on the inner "if" block. "currentOre" is a BlockDIOre, not the "ore" value.
  4. starting to think I don't either, looking at it. trying to replace the ore with a less dense version after it reaches max meta. my setup seems kinda stupid... I register 3 values from the ore constructor to 3 different HashMaps (so I can look them up to replace the ore block) and then look them up in the getNextBlock() method and check them against the current block's values to find the next densest ore. ore is the metal/gem/dust the ore has, density is the number of blocks left before the ore runs out (basically), baseBlock is what block the ore is found in like stone/dirt/gravel.
  5. I have them mostly working, but the method to get the next block is apparently not initializing the value it is passing and I'm not sure if it is the method itself that's the problem, or if it is one of the classes it calls. am I doing something stupid, or just being stupid? public Block GetNextBlock(BlockDIOre inputBlock) { Block outputBlock; DIOreRegistry registry = new DIOreRegistry(); if (registry.densityMap.get(inputBlock) != 0) { for (BlockDIOre currentOre : registry.oreMap.keySet()) { for (BlockDIOre currentOre1 : registry.densityMap.keySet()) { for (BlockDIOre currentOre2 : registry.baseBlockMap.keySet()) { if (registry.oreMap.get(currentOre).equals(registry.oreMap.get(inputBlock)) && registry.densityMap.get(currentOre1) == registry.densityMap.get(inputBlock) - 1 && registry.baseBlockMap.get(currentOre2) == registry.baseBlockMap.get(inputBlock)) { outputBlock = currentOre; } } } } } else outputBlock = registry.baseBlockMap.get(inputBlock); return outputBlock; }
  6. basically Harder Ores, except I'm trying to get it set up to generate ores from a config. hopefully that's easier than doing it during runtime. WTFOres wasn't what I was looking for, but it had a niceish config.
  7. the ores also have to break successively, but I already have that one mostly figured out.
  8. I'm making a mod to add custom ores for a modpack I'm making, how would I create ores without making a new class for each of the ores (because I have 25+ ores (metallurgy))?
  9. Apparently I forgot to edit the build.gradlew with that "idea" code snippet. Whoops!
  10. 1. create folder for workspace 2. extract contents of forge src zip into workspace folder 3. run "gradlew setupDecompWorkspace" and "gradlew idea" in workspace folder Note: step 3 does not create the same folders and files as it did in the setups prior to the issue 4. open new project in idea, point idea at build.gradle Note 2: the project loads properly, but there is no "Run Client" or "Run Server" run configurations EDIT!: I'm an idiot, this is stupid.
  11. When I generated my latest project's workspace, the default minecraft run configuration was not available and the folder structure of the workspace was different. I haven't found anything like it on the internet.
  12. The project was generated differently than before despite using forge src 1448 and the same commands each time. You guys have any advice on what to do or check? I've been trying everything I can think of to fix this and it hasn't worked.
  13. CraftingManager seems... complicated. Should I just extend it and modify that subclass, or would that cause some weird issue?
  14. Somehow didn't notice IRecipe, it does seem fairly easy to understand. Thanks!1
×
×
  • Create New...

Important Information

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