Jump to content

[1.7.2] func_147465_d not working


ScrawnyBeast

Recommended Posts

after updating to the latest version of forge, and fixing all the method names, this is what my code to place the block looks like.

 

world.setBlock(...) is what I am using to place.

 


package myMinecraftMod.tutorial.WorldGen;

import java.util.Random;

import myMinecraftMod.tutorial.Blocks.Cellulos;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;

public class WorldGenBigNetherMushroom extends WorldGenerator {

 private int mushroomType = -1;
 private static final String __OBFID = "CL_00000415";
 private Block mushBlock;

public WorldGenBigNetherMushroom() {
	super(false);
        
}

public WorldGenBigNetherMushroom(int par1) {
	super(true);
        this.mushroomType = par1;
}

@Override
public boolean generate(World world, Random random, int x, int y, int z)
    {
	//mushBlock=new Cellulos();
	mushBlock=new Cellulos(Material.wood).setBlockName("cellulosblock").setHardness(2.0F).setStepSound(new Block.SoundType("wood", 1.0F, 1.0F));


	int stalkHeight=random.nextInt(3)+10;

	for(int i=1;i<0+stalkHeight;i++)
	{
		world.setBlock(x,i,z,mushBlock,1,2);

	}

	return true;

    }

}

Link to comment
Share on other sites

 

Yeah, no. Wuppy is not using dynamic blocks, he is assigning the blocks to static fields in his mod class, and notice he is registering each of them. You need to study his code better.

Link to comment
Share on other sites

 

Yeah, no. Wuppy is not using dynamic blocks, he is assigning the blocks to static fields in his mod class, and notice he is registering each of them. You need to study his code better.

 

Right. He registers his blocks in his main mod file. Same as I did.

 

I gave the wrong link anyway. His main mod file

 

http://www.wuppy29.com/minecraft/modding-tutorials/wuppys-minecraft-forge-modding-tutorials-for-1-7-updating-1-6-to-1-7-part-2-more-modfile/

 

registers the blocks. Then it registers a world generator. The world generator uses the EventManager class he defines.

 

Here are the world generator and event manager

 

http://www.wuppy29.com/minecraft/modding-tutorials/wuppys-minecraft-forge-modding-tutorials-for-1-7-updating-1-6-to-1-7-part-6-generation-finishing-it-up/

 

In his event manager he calls the world generator. The world generator uses a new block as a prameter. Mine has no parameters. I generated a  block and initialize it in the world generator. I don't see what difference that would make. But it appears that is the only difference.

 

 

Link to comment
Share on other sites

Here's all the classes I think would matter.

 

[code/]
package myMinecraftMod.tutorial;

import myMinecraftMod.tutorial.Blocks.Cellulos;
import myMinecraftMod.tutorial.Items.CellulosItem;
import myMinecraftMod.tutorial.Recipies.Crafting;
import myMinecraftMod.tutorial.WorldGen.EventManager;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;


@Mod(modid = Tutorial.MODID, version = Tutorial.VERSION)
public class Tutorial
{

    public static final String MODID = "tutorial";
    public static final String VERSION = "1.0";
   
    public static Item cellulosItem;
    public static Block cellulosBlock;
    public static Item cellulosplankItem;
    public static Block cellulosplankBlock;
    public EventManager eventManager;
   
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
   
    }
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
    //loads all new blocks/items
    cellulosBlock = new Cellulos(Material.wood).setBlockName("cellulosblock").setHardness(2.0F).setStepSound(new Block.SoundType("wood", 1.0F, 1.0F));
    cellulosplankBlock = new Cellulos(Material.wood).setBlockName("cellulosplankblock").setHardness(2.0F).setStepSound(new Block.SoundType("wood", 1.0F, 1.0F));
    GameRegistry.registerBlock(cellulosBlock,MODID +(cellulosBlock.getUnlocalizedName().substring(5)));
    GameRegistry.registerBlock(cellulosplankBlock,MODID +(cellulosplankBlock.getUnlocalizedName().substring(5)));
   
       
        cellulosplankItem = new CellulosItem().setUnlocalizedName("cellulosplankitem");
        cellulosItem = new CellulosItem().setUnlocalizedName("cellulositem");
        GameRegistry.registerItem(cellulosplankItem, "cellulosplankitem");
        GameRegistry.registerItem(cellulosItem, "cellulositem");
       
       
        myMinecraftMod.tutorial.Recipies.Crafting.loadRecipes();
       
        eventManager=new EventManager();
       
        GameRegistry.registerWorldGenerator(eventManager, 0);
       

    }
    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
      /** TODO Hack to get our textures for items and blocks to show, remove when the bug is
        * fixed in an update.  If this is not done, then the player must manually refresh
        * the texture packs. */
     
    }
}

[code/]
package myMinecraftMod.tutorial.WorldGen;

import java.util.Random;

import myMinecraftMod.tutorial.Blocks.Cellulos;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenerator;
import cpw.mods.fml.common.IWorldGenerator;

public class EventManager implements IWorldGenerator{


public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
    {
        switch (world.provider.dimensionId)
        {
        case -1:
            generateNether(world, random, chunkX * 16, chunkZ * 16);
        case 0:
            generateSurface(world, random, chunkX * 16, chunkZ * 16);
        case 1:
            generateEnd(world, random, chunkX * 16, chunkZ * 16);
        }
    }

    private void generateEnd(World world, Random random, int x, int z)
    {

    }

    private void generateSurface(World world, Random random, int chunk_X, int chunk_Z)
    {
    	int x,z,y;
	int mushInChunk=random.nextInt(20);
	for(int j=0;j<mushInChunk;j++)
	{
		x=chunk_X+random.nextInt(16);
		z=chunk_Z+random.nextInt(16);
		Block block1,block2;
		for(int i=0;i<127;i++)
		{
			block1=world.getBlock(x,i,z);
			block2=world.getBlock(x,i+1,z);

			//if(!block1.isAir(world, x, i, z)&&block2.isAir(world, x, i+1, z))
			//{
				(new WorldGenBigNetherMushroom(new Cellulos(Material.wood).setBlockName("cellulosblock").setHardness(2.0F).setStepSound(new Block.SoundType("wood", 1.0F, 1.0F)))).generate(world,random,x,world.getTopSolidOrLiquidBlock(x, z),z);
			//}
		}
	}
    }

    private void generateNether(World world, Random random, int chunk_X, int chunk_Z)
    {
    	int x,z,y;
	int mushInChunk=random.nextInt(5);
	for(int j=0;j<mushInChunk;j++)
	{
		x=chunk_X+random.nextInt(16);
		z=chunk_Z+random.nextInt(16);
		Block block1,block2;
		for(int i=0;i<127;i++)
		{
			block1=world.getBlock(x,i,z);
			block2=world.getBlock(x,i+1,z);

			if(!block1.isAir(world, x, i, z)&&block2.isAir(world, x, i+1, z))
			{
				(new WorldGenBigNetherMushroom(new Cellulos(Material.wood).setBlockName("cellulosblock").setHardness(2.0F).setStepSound(new Block.SoundType("wood", 1.0F, 1.0F)))).generate(world,random,x,i,z);
			}
		}
	}


    }

}
[code]

[code/]

package myMinecraftMod.tutorial.WorldGen;

import java.util.Random;

import myMinecraftMod.tutorial.Blocks.Cellulos;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;

public class WorldGenBigNetherMushroom extends WorldGenerator {

 private int mushroomType = -1;
 private static final String __OBFID = "CL_00000415";
 private static Block mushBlock;

public WorldGenBigNetherMushroom(Block block) {
	super(false);
	mushBlock=block;
}

public WorldGenBigNetherMushroom(Block block,int par1) {
	super(true);
        this.mushroomType = par1;
        mushBlock=block;
}

@Override
public boolean generate(World world, Random random, int x, int y, int z)
    {
	//mushBlock=new Cellulos();
	//mushBlock=new Cellulos(Material.wood).setBlockName("cellulosblock").setHardness(2.0F).setStepSound(new Block.SoundType("wood", 1.0F, 1.0F));


	int stalkHeight=random.nextInt(3)+10;

	for(int i=1;i<0+stalkHeight;i++)
	{
		world.setBlock(x,i,z,mushBlock,1,2);

	}

	return true;

    }

}
[code]


also here is my crafting code, which doesn't seem to load 

[code/]
package myMinecraftMod.tutorial.Recipies;

import myMinecraftMod.tutorial.Tutorial;
import myMinecraftMod.tutorial.Blocks.Cellulos;
import myMinecraftMod.tutorial.Blocks.CellulosPlank;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import cpw.mods.fml.common.registry.GameRegistry;

public class Crafting {


	public static void loadRecipes() 
    {
		System.out.println("loading recipies for cellulos");
		GameRegistry.addRecipe(new ItemStack(new CellulosPlank(),4), new Object[]{
            "X",
            'X', new Cellulos()});
    }

}
[code]

Link to comment
Share on other sites

Stop creating new blocks!!! Just reference the block you already created in your main mod:

(new WorldGenBigNetherMushroom(Tutorial.cellulosBlock).generate(world,random,x,world.getTopSolidOrLiquidBlock(x, z),z);

Why on earth would you create a new block each time? That makes no sense, and nowhere in Wuppy's code do I see him do that.

Link to comment
Share on other sites

Look, OP. Doing it that way creates a huge chunk of memory in the dynamic heap (space in your RAM mamory) for every single 'new XYZ(...)' unless that class is trivial, which Block is not. About to time to fill one chunk of space with mushroom block, you have eaten up 16*16*(sizeof HugeMushRoomBlock) * height of blocks...

 

Yeah, a couple chunks and you are done! So, like everyone says, "Don't do that." Learn to code the minecraft way.

Link to comment
Share on other sites

It's not there because you cannot create blocks outside of preInit. Do not create a new block every time, like said many times above.

 

Finally an answer! So they have to be loaded in the preInit AND called from there in each other class. This answer would have saved a lot of confusion had it come earlier.

Link to comment
Share on other sites

Not really. No one explained why making a new block wouldn't work(which would have been helpful for learning). They just stated that it wouldn't.

 

But it didn't help either. Even after calling Tutorial.celluloseBlock(), which was initiated in the preInit() method, instead of making a new block I still just have empty spaces. None of my blocks get generated in the world. I can still place them from creative mode though.

Link to comment
Share on other sites

This is calling a method: Tutorial.celluloseBlock()

This is referencing a static object: Tutorial.celluloseBlock

 

If you don't understand the difference between that, then please go here and learn more about Java.

 

I understand you are frustrated, but on the other hand, please understand that creating a Block is probably one of the most basic things you can do in a mod. Most 1.7 tutorials are about updating from 1.6 to 1.7, so if you don't understand how to create a basic block, I recommend you start off by modding a little for 1.6 first, just to get the hang of it, and then port your code over to 1.7 later on when you are more comfortable with not only Java, but Minecraft code in general.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • forge simply won't boot up no matter how many mods are installed, i tried only the 1.20.1 and 1.20.6 versions and the same thing happened: nothing. the only thing that shows up in the logs is this   [14jun.2024 11:07:34.757] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, {MINECRAFT_USERNAME}, --version, 1.20.1, --gameDir, C:\Users\{COMPUTER_USERNAME}\AppData\Roaming\com.modrinth.theseus\profiles\s, --assetsDir, C:\Users\{COMPUTER_USERNAME}\AppData\Roaming\com.modrinth.theseus\meta\assets, --assetIndex, 5, --uuid, {MINECRAFT_UUID}, --accessToken, ????????, --clientId, c4502edb-87c6-40cb-b595-64a280cf8906, --xuid, 0, --userType, msa, --versionType, release, --width, 854, --height, 480, --launchTarget, forgeclient, --fml.forgeVersion, 47.2.17, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] [14jun.2024 11:07:34.765] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.11 by Azul Systems, Inc.; OS Windows 10 arch amd64 version 10.0 [14jun.2024 11:07:34.946] [main/WARN] [net.minecraftforge.fml.loading.FMLConfig/CORE]: Configuration file C:\Users\{COMPUTER_USERNAME}\AppData\Roaming\com.modrinth.theseus\profiles\s\config\fml.toml is not correct. Correcting [14jun.2024 11:07:34.948] [main/INFO] [net.minecraftforge.fml.loading.FMLConfig/CORE]: Incorrect key [earlyWindowSkipGLVersions] was corrected from null to [] [14jun.2024 11:07:34.948] [main/INFO] [net.minecraftforge.fml.loading.FMLConfig/CORE]: Incorrect key [earlyWindowSquir] was corrected from null to false [14jun.2024 11:07:34.970] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow [14jun.2024 11:07:35.208] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6   i tried in two different computers and had the same results help.....
    • Get the latest drivers from their website - do not update via system
    • https://paste.ee/p/2yikd  After installing curse forge and running 1.20.1 with 0 mods, only forge 47.3.1, this report is being yielded. Vanilla minecraft is not crashing, and I initially thought it was a mod issue, but it is clear now there is some sort of interaction between forge and my computer occurring.  Here are my computer specs for anyone wondering: TUF gaming A15 ASUS running Windows 11 Processor: AMD Ryzen 7 4800H with Radeon Graphics, fully updated (31.0.12014.6) Graphics: NVIDIA GeFORCE GTX 1660 Ti, fully updated game-ready drivers (32.0.15.5599)  I have been told this an error code related to graphics drivers, but both my integrated and dedicated drivers are entirely up to date. My AMD drivers have no version to roll back to and have never previously encountered this issue. I am seriously confused by this because I have never had an issue with running forge in the past and frequently play modded MC. This issue was exactly the same when I ran 1.19.2 with Forge version 43.2.0,  again with no mods.  Please help!!
    • Make a test without any mods - just forge If this works, add the mods in groups or one by one   Or use a pre-configured modpack as working base and add some mods  
  • Topics

×
×
  • Create New...

Important Information

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