Jump to content

Mightydanp

Members
  • Posts

    225
  • Joined

  • Last visited

Everything posted by Mightydanp

  1. so now i have for(RegistryObject<Block> blockRegistered : material.blockOre) { Block oreBlock = blockRegistered.get(); VariantBlockStateBuilder builder = getVariantBuilder(oreBlock); String modId = oreBlock.getRegistryName().toString().split(":")[0]; String oreName = oreBlock.getRegistryName().toString().split(":")[1]; String stoneVariant = oreBlock.getRegistryName().toString().split(":")[1].split("_")[0]; ModelFile ore = models().withExistingParent(oreName, "block/ore/" + stoneVariant + "_ore"); builder.forAllStates(state -> ConfiguredModel.builder().modelFile(ore).build()); simpleBlock(oreBlock , ore); simpleBlockItem(oreBlock, ore); } also i have @Mod.EventBusSubscriber(bus = Bus.MOD) because its outside the main mod class that has @Mod i put a line BlockStates class on line 29 and the breaking point hits but its not hitting inside registerStatesAndModels
  2. i have these for the block model https://github.com/mightydanp/IndustrialTech/blob/master/src/main/resources/assets/industrialtech/models/block/ore/stone_ore.json https://github.com/mightydanp/IndustrialTech/blob/master/src/main/resources/assets/industrialtech/models/block/ore/state/ore.json as-well as this for the item https://github.com/mightydanp/IndustrialTech/blob/master/src/main/resources/assets/industrialtech/models/item/stone_iron_ore.json
  3. @Mod.EventBusSubscriber(bus = Bus.MOD) public class DataGenEventHandler { @SubscribeEvent public static void gatherData(GatherDataEvent event) { DataGenerator gen = event.getGenerator(); if (event.includeClient()) { gen.addProvider(new BlockStates(gen, event.getExistingFileHelper())); } if (event.includeServer()){ } } } i have it set up like so also what in modelfile do i use use existing model i dont really need to use a parent in my blockstate
  4. 1. When i put a debug point on line 22 it gets cause but a debug point on line 34 https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/datagen/BlockStates.java#L34 doesnt catch. So what do you mean by that. 2. It is set up here on line 63 https://github.com/mightydanp/IndustrialTech/blob/master/build.gradle#L63 3.it was the onlything i could find inside modelfile that i though would mean get model by adress. Alot of the other just say parent 4. The only reason why im going throw a full list is because i dong want to make 114 lines of code of (matertialHandlerHelper) 5.i have no idea how the builder works most tutorials just throw there version of code at you without explaining what they did. 6. Thank you i didnt know that 7.i was just trying to get the block to generate. You can get the item to generate in the blockstate class ?
  5. I am trying to generate items models and block states. I am having problems with my blockstateprovider not passing in debug here is my eventhandler https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/handler/DataGenEventHandler.java i put a breaking point on 34 https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/datagen/BlockStates.java#L34 but it doesnt pass it. . i am trying to get my blockstates to look like so { "variants": { "": {"model": "industrialtech:block/ore/stone_normal_ore"} } } and my item modes to look like so { "parent": "industrialtech:block/ore/stone_normal_ore", "display": { "gui": { "rotation": [ 30, 225, 0 ], "translation": [ 0, 0, 0], "scale":[ 0.625, 0.625, 0.625 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 3, 0], "scale":[ 0.25, 0.25, 0.25 ] }, "fixed": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 0, 0], "scale":[ 0.5, 0.5, 0.5 ] }, "thirdperson_righthand": { "rotation": [ 75, 45, 0 ], "translation": [ 0, 2.5, 0], "scale": [ 0.375, 0.375, 0.375 ] }, "firstperson_righthand": { "rotation": [ 0, 45, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 0.40, 0.40, 0.40 ] }, "firstperson_lefthand": { "rotation": [ 0, 225, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 0.40, 0.40, 0.40 ] } } }
  6. Ok so i already have the DefferedRegister i registered them before i registered the ModMaterials
  7. I have these ive looked at most mods and all they use are these. Theh dont use an event handler protected static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Ref.mod_id); protected static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Ref.mod_id);
  8. The idea im trying to do is make a material handler that can generate blocks and items for me for instance atm i am working on it to do ores for me. I know theres a way to grab the blocks and items using object holders. I just dont know exactly what i am doing wrong to actually get the registry not to work. To make it duable
  9. Well thats how they generate multiple items for the material etc ring plate ingot
  10. Are you sure because have this mod that does it in 1.15.2 https://github.com/GregTech-Intergalactical/GregTech/blob/master/src/main/java/muramasa/gti/data/Materials.java
  11. This highly confuses me because i am trying to create a material handler to auto generate blocks and items.
  12. I understand what you mean by 2. But for 1. The only thing i can see thats not being registered before the items is MinecraftForge.EVENT_BUS.register(new RegistryHandler()); in CommonProxy of api.common
  13. I am using a proper git client please dont assume i am not, also i got it uploaded now dont know why it wasnt added in when i did my first upload. https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/handler/RegistryHandler.java
  14. I have no idea why the RegistryHandler class didnt upload but it is there.
  15. yes i understand I am updating my stuff to 1.16.3 you should to because most mods have updated to it
  16. I am currently having some problems getting my blocks and items to register. This is the steps i have done to try and register them. https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/IndustrialTechAPI.java registers the blocks and items inside of https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/handler/MaterialHandler.java https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/common/IndustrialTech.java registers modmaterials https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/common/materials/ModMaterials.java MaterialHandler for this is https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/handler/MaterialHandler.java is there something i am not catching?
  17. 1.14.4 is not supported in this forum. Please update to 1.15.2 or higher
  18. i am working on a custom worldgenore. ATM i am having an issue. What i am trying to do is get the block to skip generation of the ore randomly. I put (rand.nextInt(10) > 3) before the worldIn.setBlockState(.... This did nothing because all blocks in the vain would be the ore. no stone found with in the vain. So i did System.out.println(state); System.out.println(blockpos); so it turns out that it would spawn the vain sometimes all the blocks would be set to stone and some times all to ore. Bellow is my full code that I have used so far. public class WorldGenOreVain extends WorldGenerator { private final Block[] oreBlocks; /** * The number of blocks to generate. */ private final int numberOfBlocks; private Random rand = new Random(); //private final Predicate<IBlockState> predicate; public WorldGenOreVain(int blockCount, Block... blocksIn) { this.oreBlocks = blocksIn; this.numberOfBlocks = blockCount; } public boolean generate(World worldIn, Random rand, BlockPos position) { { float f = rand.nextFloat() * (float) Math.PI; double X0 = (double) ((float) (position.getX() + 8) + MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F); double X1 = (double) ((float) (position.getX() + 8) - MathHelper.sin(f) * (float) this.numberOfBlocks / 8.0F); double Z2 = (double) ((float) (position.getZ() + 8) + MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F); double Z3 = (double) ((float) (position.getZ() + 8) - MathHelper.cos(f) * (float) this.numberOfBlocks / 8.0F); double Y4 = (double) (position.getY() + rand.nextInt(3) - 2); double Y5 = (double) (position.getY() + rand.nextInt(3) - 2); for (int i = 0; i < this.numberOfBlocks; ++i) { float f1 = (float) i / (float) this.numberOfBlocks; double X6 = X0 + (X1 - X0) * (double) f1; double Y7 = Y4 + (Y5 - Y4) * (double) f1; double Z8 = Z2 + (Z3 - Z2) * (double) f1; double d9 = rand.nextDouble() * (double) this.numberOfBlocks / 16.0D; double d10 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D; double d11 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D; int j = MathHelper.floor(X6 - d10 / 2.0D); int k = MathHelper.floor(Y7 - d11 / 2.0D); int l = MathHelper.floor(Z8 - d10 / 2.0D); int i1 = MathHelper.floor(X6 + d10 / 2.0D); int j1 = MathHelper.floor(Y7 + d11 / 2.0D); int k1 = MathHelper.floor(Z8 + d10 / 2.0D); for (int x = j; x <= i1; ++x) { double d12 = ((double) x + 0.5D - X6) / (d10 / 2.0D); if (d12 * d12 < 1.0D) { for (int y = k; y <= j1; ++y) { double d13 = ((double) y + 0.5D - Y7) / (d11 / 2.0D); if (d12 * d12 + d13 * d13 < 1.0D) { for (int z = l; z <= k1; ++z) { double d14 = ((double) z + 0.5D - Z8) / (d10 / 2.0D); if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) { BlockPos blockpos = new BlockPos(x, y, z); IBlockState state = worldIn.getBlockState(blockpos); if (StoneVariant.stoneVariant.contains(state.getBlock())) { if (oreBlocks[rand.nextInt(oreBlocks.length)] instanceof BlockOre) { Block oreIn = oreBlocks[rand.nextInt(oreBlocks.length)]; if (state.getBlock() == Blocks.STONE) { if (rand.nextInt(10) > 3) { IBlockState metaOreIn = oreIn.getStateFromMeta(0); worldIn.setBlockState(blockpos, metaOreIn, 2); System.out.println("spawm" + blockpos); } else { worldIn.setBlockState(blockpos, state, 2); System.out.println(state); System.out.println(blockpos); } } } else { worldIn.setBlockState(blockpos, oreBlocks[rand.nextInt(oreBlocks.length)].getDefaultState(), 2); System.out.println(blockpos.getX() + blockpos.getY() + blockpos.getZ()); } } } } } } } } } return true; } } } oreBlocks[rand.nextInt(oreBlocks.length)] just picks a random block in block[] to be able to make multiple blocks to spawn in the vain. How would i get this to fully work
  19. I understand that but You put handstack.split(1) in the insertItem. How would that set the item in slot 1 and then split it i am confused i thought it would take the handstack and split it then you would be left with air making it not work as intended
  20. One thing that confuses me that you did handStack.split(1) inside the method but is that going to split the handstack to 0 but that will make it set nothing in slot 1 or will it set that item on the slot then split handStack to 0
  21. So i would go get stacksize and whatever minus the size of the stack we just similated
  22. Oh ok so you do that to make sure that that item can go into the slot so that it wont delete the item in your hand if it cant
  23. stack = inventory.insertItem(0, stack, true); if(stack.isEmpty()) { stack = inventory.insertItem(0, heldItem.split(1), false); Can your code. I dont understand where you remove 1 from handItem Ok so line 1 will visually put an item in slot 0. Which will make stack empty This will let it pass the of statement and then you insert the item and split it
  24. I am confused then so it makes it look like it set that item in slot 0 but doesnt ?
  25. Oh so wheb you do stack = inventory.insertItem(0, stack, true); it takes the item and set it in slot 0 but it doesnt actually move the item? thats why you can do stack = inventory.insertItem(0, heldItem.split(1), false)
×
×
  • Create New...

Important Information

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