Jump to content

Hazmatik

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by Hazmatik

  1. Is it possible to load a village structure from an NBT file created from Structure Blocks? I decided on adding a structure in the village for my villager to spawn with and I am trying to wrap my head around how to define the different blocks of the structure and was thinking it would be a lot easier if I could build the structure in world and use a Structure Block to export it to an NBT file like I've done before to spawn structures in the world in general.
  2. So I've been trying to add a custom villager to the game and I have added a villager profession and career and set up a trade and everything is working when I use a spawn egg I can get the villager from it however they don't seem to be spawning naturally in villages. Do I need to add a structure for them to spawn with or is there something else that I need to do to get them to spawn? My Professions Class: https://github.com/Hazmatik/SonicTech/blob/master/src/main/java/hazmatik/sonictech/init/STProfessions.java and here is where it is called in the init() of my main mod class: https://github.com/Hazmatik/SonicTech/blob/master/src/main/java/hazmatik/sonictech/SonicTech.java#L49
  3. The way I register my smelting recipes is I have this in my RegistryHandler public static void initRegistries() { SmeltingRecipes.init(); } for you instead of "SmeltingRecipes.init();" it would be "RecipeHandler.registerSmelting();" and then in my main mod class I call RegistryHandler.initRegistries(); in my initialization event
  4. I am registering things to the ore dictionary and I have a "Magnesite Ore" that when smelted gives a "Magnesium Ingot", I know some other mods have a "Magnesium Ore" that also gives a "Magnesium Ingot". If I want to register my "Magnesite Ore" as both "oreMagnesite" and "oreMagnesium" would this be the proper way to do it? OreDictionary.registerOre("oreMagnesite", new ItemStack(BlockInit.ORE, 1, 9)); OreDictionary.registerOre("oreMagnesium", new ItemStack(BlockInit.ORE, 1, 9));
  5. I have 10 different ores that can be smelted into 10 different ingots and I am using metadata variants for the ore blocks and also for the ingots. I set up smelting recipes and the recipes are working just fine the ores all smelt into the correct ingots, however if I shift + click the resulting ingot out of a furnace it turns into a copper ingot which is the ingot with a metadata value of 0. I'm not sure if it's something I'm missing in my ItemIngot class or something to do with the SmeltingRecipes class. ItemIngot class: package hazmatik.sonictech.items; import hazmatik.sonictech.SonicTech; import hazmatik.sonictech.init.ItemInit; import hazmatik.sonictech.util.interfaces.IHasModel; import hazmatik.sonictech.util.interfaces.IMetaName; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; import net.minecraft.util.NonNullList; public class ItemIngot extends Item implements IHasModel, IMetaName { private String name; public ItemIngot(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(SonicTech.sonictechtab); this.name = name; ItemInit.ITEMS.add(this); } @Override public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) { for(int i = 0; i < Type.METADATA_LOOKUP.length; i++) { items.add(new ItemStack(this, 1, i)); } } @Override public String getSpecialName(ItemStack stack) { return Type.values()[stack.getItemDamage()].getName(); } @Override public String getUnlocalizedName(ItemStack stack) { return super.getUnlocalizedName() + "_" + this.getSpecialName(stack); } @Override public void registerModels() { for(int i = 0; i < Type.METADATA_LOOKUP.length; i++) { SonicTech.proxy.registerVariantRenderer(this, i, "ingot_" + Type.values()[i].getName(), "inventory"); } } public enum Type implements IStringSerializable { COPPER(0, "copper"), ALUMINIUM(1, "aluminium"), ZINC(2, "zinc"), TIN(3, "tin"), ANTIMONY(4, "antimony"), MOLYBDENUM(5, "molybdenum"), LEAD(6, "lead"), SILVER(7, "silver"), CHROMIUM(8, "chromium"), MAGNESIUM(9, "magnesium"); private static final Type[] METADATA_LOOKUP = new Type[values().length]; private final int metadata; private final String name; Type(int metadata, String name) { this.metadata=metadata; this.name=name; } public int getMetadata() { return this.metadata; } @Override public String getName() { return this.name; } public static Type byMetadata(int metadata) { if(metadata < 0 || metadata >= METADATA_LOOKUP.length) { metadata = 0; } return METADATA_LOOKUP[metadata]; } static { for(Type type: values()) { METADATA_LOOKUP[type.getMetadata()] = type; } } } } and my SmeltingRecipes class: public class SmeltingRecipes { public static void init() { GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 0), new ItemStack(ItemInit.INGOT, 1, 0), 0.7f); GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 1), new ItemStack(ItemInit.INGOT, 1, 1), 0.7f); GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 2), new ItemStack(ItemInit.INGOT, 1, 2), 0.7f); GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 3), new ItemStack(ItemInit.INGOT, 1, 3), 0.7f); GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 4), new ItemStack(ItemInit.INGOT, 1, 4), 0.7f); GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 5), new ItemStack(ItemInit.INGOT, 1, 5), 0.7f); GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 6), new ItemStack(ItemInit.INGOT, 1, 6), 0.7f); GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 7), new ItemStack(ItemInit.INGOT, 1, 7), 0.7f); GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 8), new ItemStack(ItemInit.INGOT, 1, 8), 0.7f); GameRegistry.addSmelting(new ItemStack(BlockInit.ORE, 1, 9), new ItemStack(ItemInit.INGOT, 1, 9), 0.7f); } } If anyone needs to see more of my code my github repo for the project is here: https://github.com/Hazmatik/SonicTech EDIT: I don't think this is particularly related to smelting cause I just noticed any shift+click moving of the ingots even between hotbar and inventory if there is already a stack of an ingot type it will change to whichever type is there.
  6. Thank you, as I figured something simple I was overlooking. I changed "variant" to "type" in the blockstate file and everything is working now.
  7. I'm having an issue with loading model variants that is confusing me. [01:06:30] [main/ERROR] [FML]: Exception loading model for variant sonictech:ore#type=aluminium for blockstate "sonictech:ore[type=aluminium]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model sonictech:ore#type=aluminium with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:248) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:236) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:163) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:131) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:112) [SimpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:867) [Minecraft.class:?] at net.minecraft.client.Minecraft.processKeyF3(Minecraft.java:2234) [Minecraft.class:?] at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2089) [Minecraft.class:?] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1933) [Minecraft.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1189) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 26 more The part that is confusing me is that I can't figure out why it is looking for "sonictech:ore[type=aluminium]" and not "sonictech:ore_aluminium" I was getting errors for the Item models as well, because I had forgot to make the JSONs for them and for the items it was looking for "sonictech:ore_aluminium" Instead of posting more code here I'll just link to my github repo I feel like it's something minor I am just overlooking but I can't seem to find the cause of it. Any help would be appreciated. https://github.com/Hazmatik/SonicTech
  8. I have created an Obsidian geode type structure that is filled with one of my mods blocks that generates floating in the end. I want to make it so it only spawns around the outer islands and not near the main island so that the player will have to defeat the dragon and use the portal or fly/build out to the outer islands to obtain the resource. I basically want to check if it's within 1000 blocks in each x and z direction of 0,0 and if it is not generate only I'm not exactly sure how to check for specific world coordinates like that.
  9. Thanks I did that and it worked except it appears CoFH Core requires JEI be added to dependencies also so I added the version of JEI it was looking for to dependencies and the JEI maven to repositories and it worked.
  10. I am trying to add CoFH Core and RedstoneFlux as dependencies in the build.gradle for my mod following the same way ThermalExpansion does it in their build.gradle, but when I run setupDecompWorkspace the build fails and it gives this error. Could not get unknown property 'config' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. Her is my build.gradle file: buildscript { repositories { jcenter() maven { url = "http://files.minecraftforge.net/maven" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. version = "1.0" group = "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "modid" sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. compileJava { sourceCompatibility = targetCompatibility = '1.8' } minecraft { version = "1.12.2-14.23.2.2611" runDir = "run" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = "snapshot_20171003" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } repositories { maven { name = "CoFH Maven" url = "http://maven.covers1624.net" } } dependencies { deobfCompile "cofh:RedstoneFlux:${config.rf_mc_version}-${config.rf_version}:deobf" deobfCompile "cofh:CoFHCore:${config.mc_version}-${config.cofh_core_version}:deobf" } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else except the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } }
  11. I have 3 different ores I am trying to have only spawn in a certain stone variant each. I have set up predicates for each stone variant, the ores are spawning but in all variants of stone this is my OreGen class: package hazmatik.sonictech.worldgen; import java.util.Random; import hazmatik.sonictech.blocks.BlockAntimonyOre; import hazmatik.sonictech.init.ModBlocks; import net.minecraft.block.Block; import net.minecraft.block.BlockStone; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.block.state.pattern.BlockStateMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.fml.common.IWorldGenerator; public class OreGen implements IWorldGenerator { private WorldGenerator antimony_ore; private WorldGenerator chromite_ore; private WorldGenerator copper_ore; private WorldGenerator molybdenum_ore; private WorldGenerator tin_ore; private WorldGenerator zinc_ore; public OreGen() { antimony_ore = new WorldGenMinable(ModBlocks.oreAntimony.getDefaultState(), 8, new DioritePredicate()); chromite_ore = new WorldGenMinable(ModBlocks.oreChromite.getDefaultState(), 4, new NetherPredicate()); copper_ore = new WorldGenMinable(ModBlocks.oreCopper.getDefaultState(), 6); molybdenum_ore = new WorldGenMinable(ModBlocks.oreMolybdenum.getDefaultState(), 8, new GranitePredicate()); tin_ore = new WorldGenMinable(ModBlocks.oreTin.getDefaultState(), 6); zinc_ore= new WorldGenMinable(ModBlocks.oreZinc.getDefaultState(), 8, new AndesitePredicate()); } private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) { if (minHeight < 0 || maxHeight > 256 || minHeight > maxHeight) throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator"); int heightDiff = maxHeight - minHeight + 1; for (int i = 0; i < chancesToSpawn; i ++) { int x = chunk_X * 16 + rand.nextInt(16); int y = minHeight + rand.nextInt(heightDiff); int z = chunk_Z * 16 + rand.nextInt(16); generator.generate(world, rand, new BlockPos(x, y, z)); } } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.getDimension()) { case 0://Overworld this.runGenerator(zinc_ore, world, random, chunkX, chunkZ, 20, 0, 75); this.runGenerator(antimony_ore, world, random, chunkX, chunkZ, 20, 0, 75); this.runGenerator(molybdenum_ore, world, random, chunkX, chunkZ, 20, 0, 75); this.runGenerator(copper_ore, world, random, chunkX, chunkZ, 20, 0, 64); this.runGenerator(tin_ore, world, random, chunkX, chunkZ, 20, 0, 64); break; case 1://End break; case -1://Nether this.runGenerator(chromite_ore, world, random, chunkX, chunkZ, 20, 0, 126); break; } } } And this is the Predicate classes (same code just different names and meta for each variant of stone): package hazmatik.sonictech.worldgen; import com.google.common.base.Predicate; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; public class GranitePredicate implements Predicate<IBlockState> { @Override public boolean apply(IBlockState input) { return input != null && input.getBlock() == Blocks.STONE.getStateFromMeta(1); } } Any help would be appreciated.
  12. Ok so I removed the getContainerItem part out of the recipe and now have no errors in eclipse yet I don't get the tier1_frame returned when I craft the crusher into the module, is my code in the block class correct?
  13. I've been struggling to find through searching an answer to do this so I'm asking. I understand how to use the getContainerItem yet I can't seem to get it to work when the item I am crafting with is a block. Basically I have a block "Crusher Module" and when you craft it with one of the 4 tiers of machine frames it gives the appropriate tier "Crusher", I want to add a shapeless recipe where if you place a "Crusher" in the crafting grid it will return the "Crusher Module" as output and leave an empty machine frame of the appropriate tier in the crafting grid. Here is the code I have in the class for the Tier 1 Crusher public BlockT1Crusher(String unlocalizedName, String registryName) { super(Material.IRON); this.setUnlocalizedName(unlocalizedName); this.setRegistryName(new ResourceLocation(Reference.MOD_ID, registryName)); setCreativeTab(SonicTech.CREATIVE_TAB); } public boolean hasContainerItem() { return true; } public Block getContainerItem() { return ModBlocks.tier1_frame; } And this is the code for the recipe GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.crusher_module), ModBlocks.tier1_crusher.getContainerItem(ModBlocks.tier1_frame)); Yet Eclipse is showing an error at the "getContainerItem" part of the recipe and suggests to add cast to method and when I do that I get this GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.crusher_module), ((Item) ModBlocks.tier1_crusher).getContainerItem(ModBlocks.tier1_frame)); which then says cannot cast from block to item I'm stumped on what to do to get this to work.
  14. Basically what I am looking to do is have an item that can't break wood(logs, planks, fences, doors, stairs, etc.). I'm adding a sonic screwdriver instead of a wrench for use on the machines in my mod and want to keep with the whole idea from Doctor Who that it doesn't work on wood. I would prefer to have it where it won't even attempt to break the wood block if the player hits the wood with it but if that is not possible at least have it where the wood won't drop the block if the sonic is in hand when you break it. Would it be easier to make it where no blocks can be broken with the tool in hand, but it still work like a wrench would on machines?
×
×
  • Create New...

Important Information

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