Jump to content

winnetrie

Members
  • Posts

    408
  • Joined

  • Last visited

Posts posted by winnetrie

  1. I made colored clay blocks this is the class:

    public class BlockStainedClay extends BlockBase{
    	
    	public Item itemdrop;
    
    	public BlockStainedClay(Item drop, Material blockMaterialIn, MapColor blockMapColorIn, String name) {
    		super(blockMaterialIn, blockMapColorIn, name);
    		
    		
    		itemdrop = drop;
    		setHardness(0.6F);
    		setSoundType(SoundType.GROUND);
    		
    		
    	}
    	@Override
    	public Item getItemDropped(IBlockState state, Random rand, int fortune)
        {
            return itemdrop;
        }
    
        @Override
        public int quantityDropped(Random random)
        {
            return 4;
        }
    
    }

    I assigned the same material as for the minecraft clayblock and the same hardness, still my block seems te be harder as the vanilla 1? How is this posseble?

  2. Because i'm trying to code correctly as much as i can and not using the "common proxy" approach, but instead with an IProxy interface i was wondering how i register the renders correctly?

    I assume i register them directly in the clientproxy class.

    I used before a common proxy and an IHasModel interface, perhaps many of you know about this approach. But because i use the IProxy inteface approach, all that doesn't make sense anymore.

    Also because of 1.13, i also skip using metadata for blocks with for example different colors.

    So do i just register the render in the clientproxy, perhaps with a list? 

  3. 9 hours ago, DaemonUmbra said:

    Could you provide your workspace as a GitHub Repo?

    Can't do that right now, mainly because i'm not familiar with github and i do not know how to use it correctly and how it works.

    Besides that, i figured it out what the problem was. I don't know exactly what the issue was, but something was wrong with my workspace. I made a fresh 1 and all goes well now. Thank you anyway.

  4. Here is a debug log: https://pastebin.com/LVcavFY2

    I also uploaded the file.

    I don't understand why it gives a proxy error. I can't imagine all those mods are bad coded, and even if they are they work properly in a normal evironment.

    So it has to be something wrong on my side.

     

    This is my main class:

    package com.winnetrie.wie;
    
    import com.winnetrie.wie.proxy.IProxy;
    import com.winnetrie.wie.util.References;
    import net.minecraftforge.fml.common.Mod;
    import net.minecraftforge.fml.common.Mod.EventHandler;
    import net.minecraftforge.fml.common.Mod.Instance;
    import net.minecraftforge.fml.common.SidedProxy;
    import net.minecraftforge.fml.common.event.FMLInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
    
    @Mod(modid = References.MOD_ID, name = References.NAME, version = References.VERSION)
    public class Wiemod {
    	
    	@Instance
    	public static Wiemod instance;
    	
    	@SidedProxy(clientSide = References.CLIENT_PROXY_CLASS, serverSide = References.SERVER_PROXY_CLASS)
    	public static IProxy proxy;
    	
    	@EventHandler
    	public void PreInit(FMLPreInitializationEvent event)
    	{
    		//entities & networking
    	}
    	
    	@EventHandler
    	public void Init(FMLInitializationEvent event)
    	{
    		//registry events
    	}
    	
    	@EventHandler
    	public void PostInit(FMLPostInitializationEvent event)
    	{
    		//inter-mod stuff
    	}
    	@EventHandler
        public void serverStarting(FMLServerStartingEvent event)
        {
    		//server commands registering
        }
    
    	
    }

    the interface:

    package com.winnetrie.wie.proxy;
    
    import net.minecraftforge.fml.common.event.FMLInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
    
    public interface IProxy {
    	
    	//entities & networking
    	void PreInit(FMLPreInitializationEvent event);
    	
    	//registry events
    	void Init(FMLInitializationEvent event);
    	
    	//inter-mod stuff
    	void PostInit(FMLPostInitializationEvent event);
    	
    	//server commands registering
    	void ServerStarting(FMLServerStartingEvent event);
    	
    
    }

    the client class:

    package com.winnetrie.wie.proxy;
    
    import net.minecraftforge.fml.common.event.FMLInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
    
    public class ClientProxy implements IProxy{
    
    	@Override
    	public void PreInit(FMLPreInitializationEvent event) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public void Init(FMLInitializationEvent event) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public void PostInit(FMLPostInitializationEvent event) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public void ServerStarting(FMLServerStartingEvent event) {
    		// TODO Auto-generated method stub
    		
    	}
    
    }

    the server class:

    package com.winnetrie.wie.proxy;
    
    import net.minecraftforge.fml.common.event.FMLInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
    import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
    
    public class ServerProxy implements IProxy{
    
    	@Override
    	public void PreInit(FMLPreInitializationEvent event) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public void Init(FMLInitializationEvent event) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public void PostInit(FMLPostInitializationEvent event) {
    		// TODO Auto-generated method stub
    		
    	}
    
    	@Override
    	public void ServerStarting(FMLServerStartingEvent event) {
    		// TODO Auto-generated method stub
    		
    	}
    
    }

    and also a reference class: 

    package com.winnetrie.wie.util;
    
    public class References {
    	
    	public static final String MOD_ID = "wie";
    	public static final String NAME = "Winnetrie's Immersive Expansion";
    	public static final String VERSION = "1.0";
    	public static final String ACCEPTED_VERSIONS = "[1.12.2]";
    	public static final String CLIENT_PROXY_CLASS = "com.winnetrie.wie.proxy.ClientProxy";
    	public static final String SERVER_PROXY_CLASS = "com.winnetrie.wie.proxy.ServerProxy";
    
    }

    I also added the crashreport file

    debug.log

    crash-2019-04-06_23.49.34-client.txt

  5. I hope i'm doing this right. I changed the code and tested it. Everything is working fine. I even have a feeling it's working better (more accurately).

    	public void generateOverworld(World world, Random rand, int x, int z){
    		
    		int XX = x * 16;
    		int ZZ = z * 16;
    		BlockPos pos = new BlockPos(XX, 70, ZZ);
    		Biome biome = world.getBiome(pos);
    		
    		if (ConfigHandler.enable_limestone_gen == true) {
    			if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.RIVER)) {
    				generateOre(BlockInit.LIMESTONE.getDefaultState(), world, rand, 0, x, z, 25, 33, ConfigHandler.limestone_gen_chance * 2, 45, 65, BlockMatcher.forBlock(Blocks.STONE));
    			}
    			if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.OCEAN)) {
    				generateOre(BlockInit.LIMESTONE.getDefaultState(), world, rand, 0, x, z, 15, 33, ConfigHandler.limestone_gen_chance, 10, 50, BlockMatcher.forBlock(Blocks.STONE));
    			}
    		}
    		if ((ConfigHandler.enable_marblestone_gen == true) && (BiomeDictionary.hasType(biome, BiomeDictionary.Type.HILLS)) || (BiomeDictionary.hasType(biome, BiomeDictionary.Type.MOUNTAIN))) {
    			generateOre(BlockInit.MARBLESTONE.getDefaultState(), world, rand, 0, x, z, 25, 33, ConfigHandler.marblestone_gen_chance, 65, 256, BlockMatcher.forBlock(Blocks.STONE));
    		}
    	}

    Please don't say this is wrong.....:-)

  6. I have changed it to this:

    	public void generateOverworld(World world, Random rand, int x, int z){
    		
    		int XX = x * 16;
    		int ZZ = z * 16;
    		BlockPos pos = new BlockPos(XX, 70, ZZ);
    		String biome = world.getBiome(pos).getRegistryName().toString().toLowerCase();
      
    		System.out.println("Trying to generate in: "+ biome);
    		if (ConfigHandler.enable_limestone_gen == true) {
    			if (biome.contains("river")) {
    				generateOre(BlockInit.LIMESTONE.getDefaultState(), world, rand, 0, x, z, 25, 33, ConfigHandler.limestone_gen_chance * 2, 45, 65, BlockMatcher.forBlock(Blocks.STONE));
    			}
    			if (biome.contains("ocean")) {
    				generateOre(BlockInit.LIMESTONE.getDefaultState(), world, rand, 0, x, z, 15, 33, ConfigHandler.limestone_gen_chance, 10, 50, BlockMatcher.forBlock(Blocks.STONE));
    			}
    		}
    		if ((ConfigHandler.enable_marblestone_gen == true) && ((biome.contains("hills")) || (biome.contains("mountain")))) {
    			generateOre(BlockInit.MARBLESTONE.getDefaultState(), world, rand, 0, x, z, 25, 33, ConfigHandler.marblestone_gen_chance, 65, 256, BlockMatcher.forBlock(Blocks.STONE));
    		}
    	}

    Maybe not the best way. because the var biome contains also the mod id or in this case it has "minecraft:biomename"

  7. On my git i saw someone reporting a crash that happens only server sided:

    java.lang.NoSuchMethodError: net.minecraft.world.biome.Biome.func_185359_l()Ljava/lang/String;

    Is this maybe a clientside only method? The function is getBiomeName()

    What should i use instead?

     

  8. I have had some troubles with blockstates in the past and when you think you got it all, the suddenly a weird bug appears.

    I have 2 slabclasses 1 for 16 color blocks and 1 for some stone blocks.

    They have both 2 variants. The color slab has HALF and COLOR. The stoneslab class has HALF and VARIANT

     

    I had both coded both more or less the way the main issue is in the rendering method here:

    for color slab:

    @Override
        public void registerModels() {
    		
        	if (!isDouble()) {
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "color=white,half=bottom");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 1, "color=orange,half=bottom");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 2, "color=magenta,half=bottom");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 3, "color=light_blue,half=bottom");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 4, "color=yellow,half=bottom");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 5, "color=lime,half=bottom");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 6, "color=pink,half=bottom");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 7, "color=gray,half=bottom");
        	}
    		
    	}

    and for the stone slab:

        @Override
        public void registerModels() {
    		
        	if (!isDouble()) {
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "half=bottom,variant=limestone_raw");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 1, "half=bottom,variant=marblestone_raw");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 2, "half=bottom,variant=limestone_cobble");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 3, "half=bottom,variant=marblestone_cobble");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 4, "half=bottom,variant=limestone_brick");
    		Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 5, "half=bottom,variant=marblestone_brick");
        	}
    		
    	}

    Now you can see that the color slab has set the "color" variant first and then the "half" variant

    The stone class has it vica versa. I had it first in the same order has the color slab class but then i got those errors in the console it can't find an item model. Swapping the variant here solved the problem.

    Yet i don't understand why. Here are both blockstate files.

    For the terracotta brick slabs (part1):

    {
        "forge_marker": 1,
        "defaults": {
            "textures": {
                "top": "#all",
                "bottom": "#all",
                "side": "#all"
            }
        },
        "variants": {
            "half": {
                "bottom": {
                    "model": "minecraft:half_slab"
                },
                "top": {
                    "model": "minecraft:upper_slab"
                }
            },
            
    
            "color": {
                "white": {
                    "textures": {
                        "all": "tem:blocks/terracotta_white_brick"
                    }
                },
                "orange": {
                    "textures": {
                        "all": "tem:blocks/terracotta_orange_brick"                    
                    }
                },
                "magenta": {
                    "textures": {
                        "all": "tem:blocks/terracotta_magenta_brick"
                    }
                },
                "light_blue": {
                    "textures": {
                        "all": "tem:blocks/terracotta_light_blue_brick"
                    }
                },
                "yellow": {
                    "textures": {
                        "all": "tem:blocks/terracotta_yellow_brick"
                    }
                },
                "lime": {
                    "textures": {
                        "all": "tem:blocks/terracotta_lime_brick"
                    }
                },
                "pink": {
                    "textures": {
                        "all": "tem:blocks/terracotta_pink_brick"
                    }
                },
                "gray": {
                    "textures": {
                        "all": "tem:blocks/terracotta_gray_brick"
                    }
                }
            }
            
        }
    }
    
    

    and here the stoneslabs:

    {
        "forge_marker": 1,
        "defaults": {
            "textures": {
                "top": "#all",
                "bottom": "#all",
                "side": "#all"
            }
        },
        "variants": {
            "half": {
                "bottom": {
                    "model": "minecraft:half_slab"
                },
                "top": {
                    "model": "minecraft:upper_slab"
                }
            },
            
    
            "variant": {
                "limestone_raw": {
                    "textures": {
                        "all": "tem:blocks/limestone_smooth_top"
                    }
                },
                "marblestone_raw": {
                    "textures": {
                        "all": "tem:blocks/marblestone_smooth_top"                  
                    }
                },
                "limestone_cobble": {
                    "textures": {
                        "all": "tem:blocks/limestone_cobble"
                    }
                },
                "marblestone_cobble": {
                    "textures": {
                        "all": "tem:blocks/marblestone_cobble"
                    }
                },
                "limestone_brick": {
                    "textures": {
                        "all": "tem:blocks/limestone_brick"
                    }
                },
                "marblestone_brick": {
                    "textures": {
                        "all": "tem:blocks/marblestone_brick"
                    }
                }
            }
            
        }
    }
    

     

    As you can see the are structured identical

    Perhaps there is something i don't see yet.

  9. Yes i want to add a new color. There are more then 16 colors defined. If you go look in the mapColor class, you'll see 51 defined colors.

    I mean the array COLORS have 51 colors defined, so there are 12 more free slots to define.

    I found a solution.

     

  10. Alright i have added this in my class now:

    @Override
        public float getExplosionResistance(World world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
        {
        	return this.modelBlock.getExplosionResistance(world, pos, exploder, explosion);
        }
        
        @Override
        public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos)
        {
            return this.modelState.getBlockHardness(worldIn, pos);
        }
        
        @Override
        public SoundType getSoundType(IBlockState state, World world, BlockPos pos, @Nullable Entity entity)
        {
            return this.modelBlock.getSoundType(state, world, pos, entity);
        }

    It all works and no errors. I also deleted those setters in the constructor ofcourse.

    I hope this is how it should be done.

  11. So this is how my constructor looks like for my slabs class:

        public static final PropertyEnum<BlockBaseSlabColoredA.EnumType> COLOR = PropertyEnum.<BlockBaseSlabColoredA.EnumType>create("color", BlockBaseSlabColoredA.EnumType.class);
        
        private final Block modelBlock;
        private final IBlockState modelState;
        
    
        public BlockBaseSlabColoredA(String name, IBlockState state)
        {
            super(state.getMaterial());
            this.modelBlock = state.getBlock();
            this.modelState = state;
            IBlockState iblockstate = this.blockState.getBaseState().withProperty(COLOR, BlockBaseSlabColoredA.EnumType.WHITE);   
            if(!this.isDouble()){
    
            	iblockstate = iblockstate.withProperty(HALF, EnumBlockHalf.BOTTOM).withProperty(COLOR, BlockBaseSlabColoredA.EnumType.WHITE);
    		}
    
            this.setDefaultState(iblockstate);
            setUnlocalizedName(name);
            setRegistryName(name);
            setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
            setHardness(this.modelState.getBlockHardness(null, null));
            setResistance(this.modelBlock.getExplosionResistance(null, null, null, null));
            setSoundType(this.modelBlock.getSoundType(null, null, null, null));
            setHarvestLevel(this.modelBlock.getHarvestTool(state), this.modelBlock.getHarvestLevel(state));
            setLightLevel(0.0F);
            this.useNeighborBrightness = true;
    		
    		BlockInit.BLOCKS.add(this);
    
        }

    As you can see i have alot of "null" here. I guess i should not do this, but how do i get all these arguments?

  12. While it is a pleasure to help each other, we also want you to think for yourself.

    It can't be that hard to read this line:

    Quote

    Caused by: net.minecraftforge.fml.common.MissingModsException: Mod eleccore (ElecCore) requires [Forge@[12.18.3.2239,)]

    It litterally tells you the cause of the crash and why and how to fix it.

  13. Oh right i see. I changed it to this:

        @Override
        public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
        {
            //return ((BlockBaseSlabColoredA.EnumType)state.getValue(COLOR)).getMapColor();
        	//return this.modelBlock.getMapColor(modelBlock.getDefaultState(), null, null);
        	return this.modelState.getMapColor(null, null);
        }

    I'm putting "null" for both arguments. I'm not sure this is right, but it feels wrong to enter an IBlockAccess and a BlockPos here.

  14. I made many variations of existing vanilla blocks and therefore i have an IBlockState argument in my constructor in each class.

    For example for stairs and slabs you need to know on what block it is based. So i made a var called modelBlock wich i declare as "modelBlock = state.getBlock();

    I use this also to get the mapcolor for the block:

        @Override
        public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
        {
            //return ((BlockBaseSlabColoredA.EnumType)state.getValue(COLOR)).getMapColor();
        	return this.modelBlock.getMapColor(modelBlock.getDefaultState(), null, null);
        }

    I used another aproach before, wich i commented out. I wanted to have a more/ better approach.

    I wonder if this is a good approach since it looks like this getMapColor:

     

    return this.modelBlock.getMapColor(modelBlock.getDefaultState(), null, null);

     

×
×
  • Create New...

Important Information

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