Jump to content

Maciej916

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by Maciej916

  1. That's what I saw. But there must be a way to do that I can see that one mod already doing that and i know i could easly do this by adding custom crafting table but i would prefear to do it in standard crafting table.
  2. Hello my first question is if can i use custom recipe type in Crafting Table, my goal is to create crafting table recipes with require more than one item in the same slot of crafting grid. I achieved this in half way, i would say. I created custom Crafting Recipe and serializer with store count of items needed to craft. I made so it check if there is enough items in slot with are needed for craft and it is working just fine, but the issue with that is when i craft it removes only one item per slot instead of required amount and i don't know how can i achieve so it removes the correct number of items.
  3. I want to make so when the player press shift, item texture change to whatever item id is stored in the nbt data. How I can do that, where should i look for examples.
  4. Thank you, I will update the tag but the issue i have is still valid. Btw is there list of available tags in documentation?
  5. Hello I'm having problems with three generations on the 1.19.2. Basically the tree has the proper blockstates and look when it is growth from sapling but when it comes to worldgen it have the shape and look like standard oak tree and all of them looks the same. Here is what im talking about: This is how the tree should looks like and how it looks when it is growth from sapling: And this is how it looks like in worldgen: It used to work in 1.18.2 but after I updated to 1.19.2 it started to behave like this. Here is my tree classes: https://github.com/Maciej916/Industrial-Reborn/tree/1.19/src/main/java/com/maciej916/indreb/common/world/feature/tree And the configured futures and placed futures: https://github.com/Maciej916/Industrial-Reborn/blob/1.19/src/main/java/com/maciej916/indreb/common/world/feature/ModConfiguredFeatures.java https://github.com/Maciej916/Industrial-Reborn/blob/1.19/src/main/java/com/maciej916/indreb/common/world/feature/ModPlacedFeatures.java And biome modifiers: https://github.com/Maciej916/Industrial-Reborn/tree/1.19/src/main/resources/data/indreb/forge/biome_modifier Can someone help me with that I probably missed something.
  6. So basically I want to register compatibility with TheOneProbe, something like that: private void onCommonSetup(final FMLCommonSetupEvent event) { ModNetworking.setup(); ModGeneration.init(); // if the one probe is installed TOPPlugin.registerCompatibility(); } I didn't test it without mod installed but i think it will fail when it's not present.
  7. How can i check if other mod is present?
  8. That was easier than i expected, thank you for the advice, i'll use: if (level.getGameTime() % 20 == 0)
  9. I have problem with item reapearing in players hand after changing capability value. Here is what I mean by reapearing: It only happens when item has tag "active" and energy.consumeEnergy is called. Does it have something to to with capability or im doing something wrong or do i need to sync it with client? Here is the code: int tickCounter = 0; @Override public void inventoryTick(ItemStack stack, Level level, Entity entity, int p_41407_, boolean p_41408_) { if (!level.isClientSide()) { if (++tickCounter == 20) { tickCounter = 0; stack.getCapability(ModCapabilities.ENERGY).ifPresent(energy -> { CompoundTag tag = stack.getTag(); if (tag != null) { if (tag.getBoolean("active")) { energy.consumeEnergy(Math.min(energy.energyStored(), 100), false); } if (energy.energyStored() == 0) { tag.putBoolean("active", false); stack.setTag(tag); } } }); } } super.inventoryTick(stack, level, entity, p_41407_, p_41408_); }
  10. Thank you for anser, I didn't know that event even exist, I'll use it instead.
  11. Hello, I'm having troubles with adding custom generation on 1.16.3. I used solution from this post https://forums.minecraftforge.net/topic/90560-1162-how-to-add-custom-ore-to-world-generation/ and it's working for ores but i also want to add new tree and Im getting cast error RubberTreeBlockStateProvider cannot be cast to net.minecraft.world.gen.blockstateprovider.SimpleBlockStateProvider Code I use: public static void initGen() { Registry.register( WorldGenRegistries.CONFIGURED_FEATURE, ModBlocks.COPPER_ORE.getRegistryName(), Feature.ORE .withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.field_241882_a /* base_stone_overworld */, ModBlocks.COPPER_ORE.getDefaultState(), ModConfig.worldgen_copper_size)) .withPlacement(Placement.field_242907_l/* RANGE */.configure(new TopSolidRangeConfig(ModConfig.worldgen_copper_min_height, 0, ModConfig.worldgen_copper_max_height))) .func_242728_a() /* spreadHorizontally */ .func_242731_b(ModConfig.worldgen_copper_size) /* repeat */ ); Registry.register( WorldGenRegistries.CONFIGURED_FEATURE /* Feature Registering */, ModBlocks.RUBBER_SAPLING.getRegistryName() /* Resource Location */, Feature.TREE /* no_surface_ore */.withConfiguration(RUBBER_TREE_CONFIG) .withPlacement(Placement.field_242902_f/* RANGE */.configure(new AtSurfaceWithExtraConfig(12, 12, 72))) ); } public static void setupGen() { for (Map.Entry<RegistryKey<Biome>, Biome> biome : WorldGenRegistries.BIOME.getEntries() /* Collection of Biome Entries */) { if (!biome.getValue().getCategory().equals(Biome.Category.NETHER) && !biome.getValue().getCategory().equals(Biome.Category.THEEND)) { addFeatureToBiome( biome.getValue(), GenerationStage.Decoration.UNDERGROUND_ORES, WorldGenRegistries.CONFIGURED_FEATURE.getOrDefault(ModBlocks.COPPER_ORE.getRegistryName()) ); addFeatureToBiome( biome.getValue(), GenerationStage.Decoration.VEGETAL_DECORATION, WorldGenRegistries.CONFIGURED_FEATURE.getOrDefault(ModBlocks.RUBBER_SAPLING.getRegistryName()) ); } } } public static void addFeatureToBiome(Biome biome, GenerationStage.Decoration decoration, ConfiguredFeature<?, ?> configuredFeature) { List<List<Supplier<ConfiguredFeature<?, ?>>>> biomeFeatures = new ArrayList<>( biome.getGenerationSettings().getFeatures()/* List of Configured Features */ ); while (biomeFeatures.size() <= decoration.ordinal()) { biomeFeatures.add(Lists.newArrayList()); } List<Supplier<ConfiguredFeature<?, ?>>> features = new ArrayList<>(biomeFeatures.get(decoration.ordinal())); features.add(() -> configuredFeature); biomeFeatures.set(decoration.ordinal(), features); ObfuscationReflectionHelper.setPrivateValue(BiomeGenerationSettings.class, biome.getGenerationSettings(), biomeFeatures, "features"); } Rubber tree: public class RubberTree extends Tree { public static final BaseTreeFeatureConfig RUBBER_TREE_CONFIG = ( new BaseTreeFeatureConfig.Builder( new RubberTreeBlockStateProvider(ModBlocks.RUBBER_LOG.getDefaultState()), new SimpleBlockStateProvider(ModBlocks.RUBBER_LEAVES.getDefaultState()), new RubberFoliagePlacer(2, 0), new StraightTrunkPlacer(4, 2, 0), new TwoLayerFeature(1, 0, 1)) ).build(); @Nullable @Override protected ConfiguredFeature<BaseTreeFeatureConfig, ?> getTreeFeature(Random randomIn, boolean p_225546_2_) { return Feature.TREE.withConfiguration(RUBBER_TREE_CONFIG); } } Is there a simple solution to fix this? I can add that tree is working correctly in game, Im only having troubles to add it to generation.
  12. Yes i mean directory. I know i almost always use capabilities when I can, but in this case I need it. I knew how to do it in versions before 1.16 but they change it.
  13. Hello I want to save file in current world catalog and Im having problems how to get current world catalog. I tryed to use String worldName = event.getServer().func_240793_aU_().getWorldName(); But this only gives me world name not actual catalog and multiple worlds can have same name but different catalog. Any ideas how to get proper catalog?
  14. You just proved im an idiot Thank you!
  15. Every time i want to serialize or deserialize FluidTank in tile entity im getting StackOverflow issue, also when i run mod on dedicaded server and when I place block with FluidTank i'm also getting StackOverflow. Is this forge issue or i'm doing something wrong because on 1.15.2 it worked just fine. [19:45:14] [IO-Worker-18/ERROR] [minecraft/Util]: Caught exception in thread Thread[IO-Worker-18,5,SERVER] java.lang.StackOverflowError: null at java.io.DataOutputStream.write(DataOutputStream.java:107) ~[?:1.8.0_251] {} at java.io.DataOutputStream.writeUTF(DataOutputStream.java:401) ~[?:1.8.0_251] {} at java.io.DataOutputStream.writeUTF(DataOutputStream.java:323) ~[?:1.8.0_251] {} at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:407) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading} at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading} Also when I load save with FLuidTank tile im getting Caused by: java.lang.RuntimeException: Tried to read NBT tag with too high complexity, depth > 512 My code: public final FluidTank tank = new FluidTank(10); @Override public void func_230337_a_(BlockState state, @Nonnull final CompoundNBT compound) { super.func_230337_a_(state, compound); this.tank.readFromNBT(compound.getCompound("tank")); } @Override public CompoundNBT write(CompoundNBT compound) { super.write(compound); compound.put("tank", this.tank.writeToNBT(compound)); return compound; } Forge version: 32.0.41
  16. Hello I tryed to generate json resources but GatherDataEvent is never called and idk why because it worked before and now it's not beeing called, there is no error in console. DataGenerators.class @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class DataGenerators { @SubscribeEvent public static void gatherData(GatherDataEvent event) { DataGenerator generator = event.getGenerator(); if (event.includeServer()) { generator.addProvider(new Recipes(generator)); generator.addProvider(new LootTables(generator)); } } } build.gradle data { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' args '--mod', 'indreb', '--all', '--output', file('src/generated/resources/') environment 'target', 'fmluserdevdata' mods { indreb { source sourceSets.main } } }
  17. Oh didn't know about that ty again new ResourceLocation(MODID,"...")
  18. Thank you it worked CookingRecipeBuilder.smeltingRecipe(Ingredient.fromItems(ModBlocks.COPPER_ORE.get()), ModItems.COPPER_INGOT.get(), 0.6f, 200) .addCriterion("item", InventoryChangeTrigger.Instance.forItems(ModBlocks.COPPER_ORE.get())) .build(consumer, new ResourceLocation("copper_ingot_smelting"));
  19. Hello Im trying to generate json recepies by using Receipe Provider and everything is working fine but when I want to add another recipe for same item is show "Duplicate recipe..." error. I want to add crafting and smelting recipe and second one will throw duplicate error. Im just started to use this method so probably it's easy to fix. protected void registerRecipes(Consumer<IFinishedRecipe> consumer) { ShapedRecipeBuilder.shapedRecipe(ModItems.COPPER_INGOT.get(), 9) .patternLine("x ") .key('x', ModBlocks.COPPER_BLOCK.get()) .setGroup(MODID) .addCriterion("item", InventoryChangeTrigger.Instance.forItems(ModBlocks.COPPER_BLOCK.get())) .build(consumer); CookingRecipeBuilder.smeltingRecipe(Ingredient.fromItems(ModBlocks.COPPER_ORE.get()), ModItems.COPPER_INGOT.get(), 0.6f, 200) .addCriterion("item", InventoryChangeTrigger.Instance.forItems(ModBlocks.COPPER_ORE.get())) .build(consumer); } Error: Caused by: java.lang.IllegalStateException: Duplicate recipe indreb:copper_ingot
  20. This is basicly how the current code works. When you place a cable it looks for network around and possible outputs and inputs, if there is non eit create new network, if there is one it join that nrtwork and if there is more than on it merge all. Each network of cables know possible inputs and outputs and have little storage but can accept or output energy only if there is a valid machine connected. When you break cable it try to rebuild network if network split it create new ones and each new network also know inputs and outputs.
  21. Hello, couple days ago I started making tech mod but after I add couple machines i realized that I need some sort of cables to transport energy from one machine to another. When I started i didn't know that it will be that hard to make but after some days I was able to make something that works. I know there is some bugs and issues with it and some things are still missing. There is many people on this forum that are more advanced in java programming that Im, If you one of this people you probably can help me improve my code. Im not asking you to code anything just look at my code and give me clues what i can improve or remake to make it better. Source: https://github.com/Maciej916/Test-Mod/tree/master/src/main/java/com/maciej916/testmod
  22. Can I just subscribe to WorldTickEvent and get capability and call update in that capability every tick or it's bad idea?
  23. I don't think it's possibel because it want to load class from client, how can i tick this in other ways? Code: https://github.com/Maciej916/Test-Mod/blob/master/src/main/java/com/maciej916/testmod/common/capabilities/energy/EnergyNetworkList.java Error: java.lang.NoClassDefFoundError: net/minecraft/client/renderer/texture/ITickable at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_211] {} at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.8.0_211] {} at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.8.0_211] {} at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:127) ~[modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:96) ~[modlauncher-5.0.0-milestone.4.jar:?] {} at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_211] {} at com.maciej916.testmod.ForgeEventSubscriber.onAttachCapabilities(ForgeEventSubscriber.java:18) ~[?:1.15.1-0.1.0] {re:classloading} at net.minecraftforge.eventbus.ASMEventHandler_5_ForgeEventSubscriber_onAttachCapabilities_AttachCapabilitiesEvent.invoke(.dynamic) ~[?:?] {} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:564) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(ForgeEventFactory.java:558) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraftforge.common.capabilities.CapabilityProvider.gatherCapabilities(CapabilityProvider.java:48) ~[?:?] {re:classloading} at net.minecraft.world.server.ServerWorld.initCapabilities(ServerWorld.java:1419) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.world.server.ServerWorld.<init>(ServerWorld.java:190) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.func_213194_a(MinecraftServer.java:372) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:361) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:210) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:610) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at java.lang.Thread.run(Unknown Source) [?:1.8.0_211] {} Caused by: java.lang.ClassNotFoundException: net.minecraft.client.renderer.texture.ITickable at java.lang.ClassLoader.findClass(Unknown Source) ~[?:1.8.0_211] {} at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_211] {} at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:101) ~[modlauncher-5.0.0-milestone.4.jar:?] {} at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_211] {} ... 20 more
×
×
  • Create New...

Important Information

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