Jump to content

me1

Members
  • Posts

    31
  • Joined

  • Last visited

Posts posted by me1

  1. I've tried 

    onDeath(DamageSource.MAGIC);

    But that didn't work.

    This is probably a stupid question but I can't find an answer in the Minecraft code and am running out of ideas.

    EDIT: by entity I mean AnimalEntity

  2. 38 minutes ago, GenElectrovise said:

    What version are you using?

     

    For 1.15.2:

    A crafting recipe for a spawn egg? Or a spawner block with a mob in it?

     

    If it's a custom item, make a normal crafting recipe for it.

     

    If it's a Minecraft spawn egg (from MC's SpawnEggItem) to spawn a custom entity, the Minecraft spawn egg system is not good for modding. You're better off making a custom item to spawn the entity, then following my last suggestion.

    Sorry for not being very clear: I want to make a craft for a spawner block, which will have an entity from my mod in it. As I understand from your post, you thinkI should make a custom Block extending SpawnerBlock and change the spawned Entity? Where would I change that?

    (I'm on 1.15.2)

  3. Here's my new code:

    private void setup(final FMLCommonSetupEvent event) {
            for(int i = 0; i < 5000; ++i)
                LOGGER.info("SETUP");
            BlockInit.onOreGeneration();
            OreGenerator.generateOre();
        }
    
        public static void deferredWorkQueue(DeferredWorkQueue  queue)
        {
            for(int i = 0; i < 5000; ++i)
                LOGGER.info("SETUP");
            BlockInit.onOreGeneration();
            OreGenerator.generateOre();
        }

    //^ MainClass Updated

    public static void generateOre() {
            for (Object oreType : Ores.toArray())
                    for (int i = 0; i < ((OreType)oreType).biomes.length; ++i)
                        {Biome biome = ((OreType)oreType).biomes[i];
                            OreType ore = (OreType) oreType;
                            ConfiguredPlacement placement = Placement.COUNT_RANGE.configure(ore.countRangeConfig);
                            biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(
                                    new OreFeatureConfig(ore.fillerBlockType, ore.ore, ore.size)).withPlacement(placement));
                        }
        }

    //^ OreGenerator Updated

  4. I change the whole double loop nonesence, translated the FMLLoadCompleteEvent to to FMLCommonSetupEvent and added it to DefferedWorkQueue and... it still soesn't work :(

    Here is some more information some might find usefull:

    -I don't you Deferred Registers. I use the othe method(dunno how it's called).

    -I also can't find my biomes.

    -The blocks work when. I can place them, I can craft them, I just can't find them under the ground(I seearched for multiple minuets)

  5. So I have these Blocks(white_empty_block & black_empty_block) witch I want to spawn underground just like Ores. Sadly it isn't working. I don't know where the problem is. I added some logs and all methods I want to be called are called. Here are some parts of my code:

        @SubscribeEvent
        public static void loadCompleteEvent(FMLLoadCompleteEvent event)
        {
            BlockInit.onOreGeneration();
            OreGenerator.generateOre();
        }

    // ^ This is in my main Class

    public static void onOreGeneration()
        {
            Biome[] overWorld = getBiomes(BiomeDictionary.Type.OVERWORLD);
            OreGenerator.Ores.add(new OreGenerator.OreType(white_empty_block.getDefaultState(), overWorld, new CountRangeConfig(1180, 8, 8, 124), OreFeatureConfig.FillerBlockType.NATURAL_STONE, 2));
            OreGenerator.Ores.add(new OreGenerator.OreType(black_empty_block.getDefaultState(), overWorld, new CountRangeConfig(1140, 8, 8, 124), OreFeatureConfig.FillerBlockType.NATURAL_STONE, 2));
        }

    //^ This is in my BlockInit

    public class OreGenerator {
        public static class OreType {
            public final BlockState ore;
            public final Biome[] biomes;
            public final CountRangeConfig countRangeConfig;
            public final OreFeatureConfig.FillerBlockType fillerBlockType;
            public final int size;
    
            public OreType(BlockState ore, Biome[] biomesIn, CountRangeConfig countRangeConfig, OreFeatureConfig.FillerBlockType fillerBlock, int maxGroupSize) {
                this.ore = ore;
                biomes = biomesIn;
                this.countRangeConfig = countRangeConfig;
                fillerBlockType = fillerBlock;
                size = maxGroupSize;
            }
        }
    
        public static final ArrayList<OreType> Ores = new ArrayList<OreType>();
    
        public static void generateOre() {
            for (Object oreType : Ores.toArray())
                for (int i = 0; i < ForgeRegistries.BIOMES.getValues().size(); ++i) {
                    for (Biome biomeCan : ((OreType) oreType).biomes)
                        if (ForgeRegistries.BIOMES.getValues().contains(biomeCan)) {
                            OreType ore = (OreType) oreType;
                            ConfiguredPlacement placement = Placement.COUNT_RANGE.configure(ore.countRangeConfig);
                            ((Biome)ForgeRegistries.BIOMES.getValues().toArray()[i]).addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.withConfiguration(
                                    new OreFeatureConfig(ore.fillerBlockType, ore.ore, ore.size)).withPlacement(placement));
                        }
                }
        }
    
        public static Biome[] getBiomes(BiomeDictionary.Type type) {
            Object[] _biomes = BiomeDictionary.getBiomes(type).toArray();
            Biome[] biomes = new Biome[_biomes.length];
            for (int i = 0; i < _biomes.length; ++i)
                biomes[i] = (Biome) _biomes[i];
            return biomes;
        }
    }

    //^ This is My OreGenerator Class

     

    Please help.

  6. I followed a tutorial and there was the following code:

    return InputMappings.isKeyDown(Minecraft.getInstance().getMainWindow().getHandle(), glfw);

    But for me the 'getMainWindow()' was underlined red.

    I looked through the IntelliJ-Hints and the only function whitch returns a 'MainWindow' is 'func_228018_at_()'.

    When I run it with MainWindow it starts minecraft but closes it again after some time saying:

    [16:19:41] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:109]: ---- Minecraft Crash Report ----
    // Hi. I'm Minecraft, and I'm a crashaholic.
    
    Time: 03.04.20 16:19
    Description: Initializing game
    
    java.lang.NoSuchMethodError: net.minecraft.client.Minecraft.getMainWindow()Lnet/minecraft/client/MainWindow;
    	at com.nkdm.emptyblock.EmptyBlock.getKey(EmptyBlock.java:68) ~[main/:?] {re:classloading}
    	at     *...*
        
        
        Process finished with exit code -1

     

    When I run it with func_228018_at_ it instantly says:

    C:\Users\*ME1*\IdeaProjects\emptyblock\src\main\java\com\nkdm\emptyblock\EmptyBlock.java:68: error: cannot find symbol
            return InputMappings.isKeyDown(Minecraft.getInstance().func_228018_at_().getHandle(), glfw);
                                                                  ^
      symbol:   method func_228018_at_()
      location: class Minecraft

     

    I use IntelliJ and have the newest mappings.

    Please help!

×
×
  • Create New...

Important Information

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