Topic category: Help with Minecraft modding (Java Edition)
This is the code I came up with, along with help from another website.
It doesn't work. Does anyone know how to fix this?
Code;
package net.mcreator.weirdostuff;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import java.util.List;
import java.util.Random;
import net.minecraft.block.state.IBlockstate;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModBlockColors implements IBlockColor
{
public static final IBlockColor INSTANCE = new ModBlockColors();
public static Random rand = new Random();
{
List<EntityPlayer> players = Minecraft.getMinecraft().world.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.add(-3, 1, -3), pos.add(3, 2, 3)));
if (!players.isEmpty())
{
return 0xC2EDFF
}
else
{
return 0xFFFFFF
}
public static void registerBlockColors()
{
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(INSANCE, ModBlocks.deadleaves);
}
}
@WeirdoStuffElements.ModElement.Tag
public class BiomeColors extends WeirdoStuffElements.ModElement {
/**
* Do not remove this constructor
*/
public BiomeColors(WeirdoStuffElements instance) {
super(instance, 179);
}
@Override
public void initElements() {
}
@Override
public void init(FMLCommonSetupEvent event) {
}
@Override
public void serverLoad(FMLServerStartingEvent event) {
}
}
You have two public classes in one file. I strongly suggest you to actually learn Java first if you want to program.