Very Long Error

Started by ssw663 on Mon, 02/20/2017 - 16:27

Topic category: Help with modding (Java Edition)

Last seen on 17:33, 25. Jul 2017
Joined May 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Very Long Error
Mon, 02/20/2017 - 16:27

The title is pretty self-explanatory.  I'm making an Advanced Warfare mod with multiple futuristic weapons, but right after I finished a GUI I got the following error:

http://pastebin.com/5CVkxZCv

My mod had the following files:

ClientProxyTestEnvironmentMod:

package mod.mcreator;

public class ClientProxyTestEnvironmentMod extends CommonProxyTestEnvironmentMod {

    @Override
    public void registerRenderers(TestEnvironmentMod ins) {
        ins.mcreator_0.registerRenderers();
        ins.mcreator_1.registerRenderers();
        ins.mcreator_2.registerRenderers();
        ins.mcreator_3.registerRenderers();
        ins.mcreator_4.registerRenderers();
        ins.mcreator_5.registerRenderers();

    }
}

CommonProxyTestEnvironmentMod:

package mod.mcreator;

public class CommonProxyTestEnvironmentMod {
    public void registerRenderers(TestEnvironmentMod ins) {
    }
}

GlobalEventsTestEnvironmentMod:

package mod.mcreator;

public class mcreator_GlobalEventsTestEnvironmentMod {

}

VarListTestEnvironmentMod:

package mod.mcreator;

public class mcreator_VarListTestEnvironmentMod {

}

TestEnvironmentMod:

package mod.mcreator;

import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.IWorldGenerator;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.client.model.obj.OBJLoader;

import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.player.EntityPlayer;

import java.util.Random;

@Mod(modid = TestEnvironmentMod.MODID, version = TestEnvironmentMod.VERSION)
public class TestEnvironmentMod implements IFuelHandler, IWorldGenerator {

    public static final String MODID = "TestEnvironmentMod";
    public static final String VERSION = "1.0";

    @SidedProxy(clientSide = "mod.mcreator.ClientProxyTestEnvironmentMod", serverSide = "mod.mcreator.CommonProxyTestEnvironmentMod")
    public static CommonProxyTestEnvironmentMod proxy;

    @Instance(MODID)
    public static TestEnvironmentMod instance;

    mcreator_locationZapper mcreator_0 = new mcreator_locationZapper();
    mcreator_advancedWarfare mcreator_1 = new mcreator_advancedWarfare();
    mcreator_sniperRifle mcreator_2 = new mcreator_sniperRifle();
    mcreator_bullet mcreator_3 = new mcreator_bullet();
    mcreator_ironRod mcreator_4 = new mcreator_ironRod();
    mcreator_locationZapperGUI mcreator_5 = new mcreator_locationZapperGUI();

    @Override
    public int getBurnTime(ItemStack fuel) {
        if (mcreator_0.addFuel(fuel) != 0)
            return mcreator_0.addFuel(fuel);
        if (mcreator_1.addFuel(fuel) != 0)
            return mcreator_1.addFuel(fuel);
        if (mcreator_2.addFuel(fuel) != 0)
            return mcreator_2.addFuel(fuel);
        if (mcreator_3.addFuel(fuel) != 0)
            return mcreator_3.addFuel(fuel);
        if (mcreator_4.addFuel(fuel) != 0)
            return mcreator_4.addFuel(fuel);
        if (mcreator_5.addFuel(fuel) != 0)
            return mcreator_5.addFuel(fuel);
        return 0;
    }

    @Override
    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {

        chunkX = chunkX * 16;
        chunkZ = chunkZ * 16;
        if (world.provider.getDimension() == -1)
            mcreator_0.generateNether(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == 0)
            mcreator_0.generateSurface(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == -1)
            mcreator_1.generateNether(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == 0)
            mcreator_1.generateSurface(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == -1)
            mcreator_2.generateNether(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == 0)
            mcreator_2.generateSurface(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == -1)
            mcreator_3.generateNether(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == 0)
            mcreator_3.generateSurface(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == -1)
            mcreator_4.generateNether(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == 0)
            mcreator_4.generateSurface(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == -1)
            mcreator_5.generateNether(world, random, chunkX, chunkZ);
        if (world.provider.getDimension() == 0)
            mcreator_5.generateSurface(world, random, chunkX, chunkZ);

    }

    @EventHandler
    public void load(FMLInitializationEvent event) {

        GameRegistry.registerFuelHandler(this);
        GameRegistry.registerWorldGenerator(this, 1);
        if (event.getSide() == Side.CLIENT) {
            OBJLoader.INSTANCE.addDomain("TestEnvironmentMod");
        }
        MinecraftForge.EVENT_BUS.register(new mcreator_GlobalEventsTestEnvironmentMod());
        NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
        mcreator_0.load(event);
        mcreator_1.load(event);
        mcreator_2.load(event);
        mcreator_3.load(event);
        mcreator_4.load(event);
        mcreator_5.load(event);
        proxy.registerRenderers(this);

    }

    @EventHandler
    public void serverLoad(FMLServerStartingEvent event) {
        mcreator_0.serverLoad(event);
        mcreator_1.serverLoad(event);
        mcreator_2.serverLoad(event);
        mcreator_3.serverLoad(event);
        mcreator_4.serverLoad(event);
        mcreator_5.serverLoad(event);
    }

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        mcreator_0.instance = this.instance;
        mcreator_1.instance = this.instance;
        mcreator_2.instance = this.instance;
        mcreator_3.instance = this.instance;
        mcreator_4.instance = this.instance;
        mcreator_5.instance = this.instance;
        mcreator_0.preInit(event);
        mcreator_1.preInit(event);
        mcreator_2.preInit(event);
        mcreator_3.preInit(event);
        mcreator_4.preInit(event);
        mcreator_5.preInit(event);

    }

    public static class GuiHandler implements IGuiHandler {
        @Override
        public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
            if (id == mcreator_locationZapperGUI.GUIID)
                return new mcreator_locationZapperGUI.GuiContainerMod(world, x, y, z, player);
            return null;
        }

        @Override
        public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
            if (id == mcreator_locationZapperGUI.GUIID)
                return new mcreator_locationZapperGUI.GuiWindow(world, x, y, z, player);
            return null;
        }
    }

}

AdvancedWarfare:

package mod.mcreator;

import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.creativetab.CreativeTabs;

import java.util.Random;

public class mcreator_advancedWarfare {

    public static Object instance;

    public static CreativeTabs tab = new CreativeTabs("tabadvancedWarfare") {
        @SideOnly(Side.CLIENT)
        public Item getTabIconItem() {
            return new ItemStack(mcreator_sniperRifle.block).getItem();
        }

    };

    public mcreator_advancedWarfare() {
    }

    public void load(FMLInitializationEvent event) {
    }

    public void registerRenderers() {
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {
    }

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
    }

    public int addFuel(ItemStack fuel) {
        return 0;
    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
    }

}

Bullet:

package mod.mcreator;

import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.init.Items;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.Block;

import java.util.Random;

@SuppressWarnings("unchecked")
public class mcreator_bullet {

    public mcreator_bullet() {
    }

    public static Item block;
    public static Object instance;

    public void load(FMLInitializationEvent event) {
        if (event.getSide() == Side.CLIENT)
            Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
                    .register(block, 0, new ModelResourceLocation("TestEnvironmentMod:Bullet", "inventory"));

        GameRegistry.addRecipe(new ItemStack(block, 8),
                new Object[]{"XXX", "X4X", "X7X", Character.valueOf('4'), mcreator_ironRod.block, Character.valueOf('7'), Items.IRON_INGOT,});
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {
    }

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
    }

    public int addFuel(ItemStack fuel) {
        return 0;
    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
    }

    public void registerRenderers() {
    }

    static {
        block = (new Itembullet(433));

    }

    static class Itembullet extends Item {

        public Itembullet(int par1) {
            setMaxDamage(0);
            maxStackSize = 64;
            setUnlocalizedName("Bullet");
            GameRegistry.registerItem(this, "Bullet");
            setCreativeTab(mcreator_advancedWarfare.tab);
        }

        @Override
        public int getItemEnchantability() {
            return 0;
        }

        @Override
        public int getMaxItemUseDuration(ItemStack par1ItemStack) {
            return 0;
        }

        @Override
        public float getStrVsBlock(ItemStack par1ItemStack, IBlockState par2Block) {
            return 1.0F;
        }

    }
}

IronRod:

package mod.mcreator;

import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.init.Items;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.Block;

import java.util.Random;

@SuppressWarnings("unchecked")
public class mcreator_ironRod {

    public mcreator_ironRod() {
    }

    public static Item block;
    public static Object instance;

    public void load(FMLInitializationEvent event) {
        if (event.getSide() == Side.CLIENT)
            Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
                    .register(block, 0, new ModelResourceLocation("TestEnvironmentMod:IronRod", "inventory"));

        GameRegistry.addRecipe(new ItemStack(block, 4),
                new Object[]{"XXX", "X4X", "X7X", Character.valueOf('4'), Items.IRON_INGOT, Character.valueOf('7'), Items.IRON_INGOT,});
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {
    }

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
    }

    public int addFuel(ItemStack fuel) {
        return 0;
    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
    }

    public void registerRenderers() {
    }

    static {
        block = (new ItemironRod(434));

    }

    static class ItemironRod extends Item {

        public ItemironRod(int par1) {
            setMaxDamage(0);
            maxStackSize = 64;
            setUnlocalizedName("IronRod");
            GameRegistry.registerItem(this, "IronRod");
            setCreativeTab(CreativeTabs.MATERIALS);
        }

        @Override
        public int getItemEnchantability() {
            return 0;
        }

        @Override
        public int getMaxItemUseDuration(ItemStack par1ItemStack) {
            return 0;
        }

        @Override
        public float getStrVsBlock(ItemStack par1ItemStack, IBlockState par2Block) {
            return 1.0F;
        }

    }
}

SniperRifle:

import net.minecraftforge.fml.client.registry.RenderingRegistry;

import net.minecraft.world.World;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.ActionResult;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.item.EnumAction;
import net.minecraft.init.Items;
import net.minecraft.init.Enchantments;
import net.minecraft.init.Blocks;
import net.minecraft.entity.projectile.EntityTippedArrow;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.Entity;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.block.Block;

import java.util.Random;

public class mcreator_sniperRifle {

    public mcreator_sniperRifle() {
    }

    public static Item block;
    public static Object instance;

    public void load(FMLInitializationEvent event) {
        if (event.getSide() == Side.CLIENT) {
            Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
                    .register(block, 0, new ModelResourceLocation("TestEnvironmentMod:sniperRifle", "inventory"));
        }

        GameRegistry.addRecipe(new ItemStack(block, 1),
                new Object[]{"012", "XX5", "678", Character.valueOf('0'), mcreator_ironRod.block, Character.valueOf('1'), mcreator_ironRod.block,
                        Character.valueOf('2'), mcreator_ironRod.block, Character.valueOf('5'), mcreator_ironRod.block, Character.valueOf('6'),
                        mcreator_ironRod.block, Character.valueOf('7'), mcreator_ironRod.block, Character.valueOf('8'), mcreator_ironRod.block,});
    }

    @SideOnly(Side.CLIENT)
    public void registerRenderers() {
        RenderingRegistry.registerEntityRenderingHandler(EntityArrowCustom.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(),
                new ItemStack(mcreator_bullet.block).getItem(), Minecraft.getMinecraft().getRenderItem()));
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {
    }

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
    }

    public int addFuel(ItemStack fuel) {
        return 0;
    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
        int entityID = MathHelper.getRandomUUID().hashCode();
        EntityRegistry.registerModEntity(EntityArrowCustom.class, "entityBulletsniperRifle", entityID, instance, 64, 1, true);
    }

    static {
        block = (new ItemgGUN());
    }

    static class ItemgGUN extends Item {

        public ItemgGUN() {
            super();
            setMaxDamage(100);
            maxStackSize = 1;
            setFull3D();
            setUnlocalizedName("sniperRifle");
            GameRegistry.registerItem(this, "sniperRifle");
            setCreativeTab(mcreator_advancedWarfare.tab);
        }

        @Override
        public int getMaxItemUseDuration(ItemStack par1ItemStack) {
            return 72000;
        }

        @Override
        public ActionResult<ItemStack> onItemRightClick(final ItemStack par1ItemStack, final World par2World, final EntityPlayer par3EntityPlayer,
                EnumHand hand) {

            par3EntityPlayer.setActiveHand(hand);

            boolean flag = par3EntityPlayer.capabilities.isCreativeMode
                    || EnchantmentHelper.getEnchantmentLevel(Enchantments.INFINITY, par1ItemStack) > 0;

            if (flag || par3EntityPlayer.inventory.hasItemStack(new ItemStack(mcreator_bullet.block))) {
                    if (flag || par3EntityPlayer.inventory.hasItemStack(new ItemStack(Items.GUNPOWDER))) {
                     float f = 20.0F;
     
                     EntityArrowCustom entityarrow = new EntityArrowCustom(par2World, par3EntityPlayer) {
                         @Override
                         public void onCollideWithPlayer(EntityPlayer entity) {
                             super.onCollideWithPlayer(entity);
                             int i = MathHelper.floor_double(this.getEntityBoundingBox().minX + 0.001D);
                             int j = MathHelper.floor_double(this.getEntityBoundingBox().minY + 0.001D);
                             int k = MathHelper.floor_double(this.getEntityBoundingBox().minZ + 0.001D);
                             World world = this.worldObj;
     
                         }
     
                         @Override
                         public void onUpdate() {
                             super.onUpdate();
                             int i = MathHelper.floor_double(this.getEntityBoundingBox().minX + 0.001D);
                             int j = MathHelper.floor_double(this.getEntityBoundingBox().minY + 0.001D);
                             int k = MathHelper.floor_double(this.getEntityBoundingBox().minZ + 0.001D);
                             World world = this.worldObj;
                             Entity entity = (Entity) par3EntityPlayer;
     
                             if (getBlock(this.worldObj, i, j, k) != Blocks.AIR || getBlock(this.worldObj, i, j - 1, k) != Blocks.AIR
                                     || getBlock(this.worldObj, i, j + 1, k) != Blocks.AIR || getBlock(this.worldObj, i + 1, j, k) != Blocks.AIR
                                     || getBlock(this.worldObj, i - 1, j, k) != Blocks.AIR || getBlock(this.worldObj, i, j, k + 1) != Blocks.AIR
                                     || getBlock(this.worldObj, i, j, k - 1) != Blocks.AIR) {
     
                                 this.kill();
                             }
     
                         }
     
                     };
     
                     entityarrow.setThrowableHeading(par3EntityPlayer.getLookVec().xCoord, par3EntityPlayer.getLookVec().yCoord,
                             par3EntityPlayer.getLookVec().zCoord, f * 2.0F, 0);
                     entityarrow.setIsCritical(true);
                     entityarrow.setDamage(30.0);
                     entityarrow.setKnockbackStrength(7);
     
                     if (false) {
                         entityarrow.setFire(100);
                     }
     
                     par1ItemStack.damageItem(1, par3EntityPlayer);
                     int i = (int) par3EntityPlayer.posX;
                     int j = (int) par3EntityPlayer.posY;
                     int k = (int) par3EntityPlayer.posZ;
                     par2World.playSound((EntityPlayer) null, (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D,
                             (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation(
                                     ("entity.generic.explode"))), SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
     
                     if (flag) {
                         entityarrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
                     } else {
                         par3EntityPlayer.inventory.clearMatchingItems(new ItemStack(mcreator_bullet.block).getItem(), -1, 1, null);
                     }
     
                     if (!par2World.isRemote) {
                         par2World.spawnEntityInWorld(entityarrow);
                     }
                     World world = par2World;
                     EntityPlayer entity = par3EntityPlayer;
     
                     if (true) {
                         world.playSound((EntityPlayer) null, (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D,
                                 (net.minecraft.util.SoundEvent) net.minecraft.util.SoundEvent.REGISTRY.getObject(new ResourceLocation(
                                         ("entity.generic.explode"))), SoundCategory.NEUTRAL, 1.0F, 1.0F);
                     }
     
                     if (entity.inventory.hasItemStack(new ItemStack(Items.GUNPOWDER))) {
                         if (entity instanceof EntityPlayer)
                             ((EntityPlayer) entity).inventory.clearMatchingItems(Items.GUNPOWDER, -1, 1, null);
                     }
                    }

            }

            return new ActionResult(EnumActionResult.SUCCESS, par1ItemStack);
        }

        public Block getBlock(World par1World, int i, int j, int k) {
            return par1World.getBlockState(new BlockPos(i, j, k)).getBlock();
        }

        @Override
        public EnumAction getItemUseAction(ItemStack par1ItemStack) {
            return EnumAction.BOW;
        }

    }

    public static class EntityArrowCustom extends EntityTippedArrow {
        public EntityArrowCustom(World a) {
            super(a);
        }

        public EntityArrowCustom(World worldIn, double x, double y, double z) {
            super(worldIn, x, y, z);
        }

        public EntityArrowCustom(World worldIn, EntityLivingBase shooter) {
            super(worldIn, shooter);
        }
    }

}

LocationZapper:

 

import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraft.world.World;
import net.minecraft.world.IBlockAccess;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumHand;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.material.Material;
import net.minecraft.block.SoundType;
import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.BlockHorizontal;
import java.util.Random;

public class mcreator_locationZapper {
     
     public mcreator_locationZapper() {
     }

     public static BlockLocationZapper block;

     public static Object instance;

     public int addFuel(ItemStack fuel) {
          return 0;
     }

     public void serverLoad(FMLServerStartingEvent event) {
     }

     public void preInit(FMLPreInitializationEvent event) {
     }

     public void registerRenderers() {
     }

     public void load(FMLInitializationEvent event) {
          if (event.getSide() == Side.CLIENT) {
               Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
                         .register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("TestEnvironmentMod:LocationZapper", "inventory"));
          }
     }

     static {

          block = (BlockLocationZapper) (new BlockLocationZapper().setHardness(2.0F).setResistance(27.5F).setLightLevel(0.0F)
                    .setUnlocalizedName("LocationZapper").setLightOpacity(0).setCreativeTab(mcreator_advancedWarfare.tab));
          block.setHarvestLevel("pickaxe", 1);
     }

     public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
     }

     public void generateNether(World world, Random random, int chunkX, int chunkZ) {
     }

     static class BlockLocationZapper extends Block {

          public static final PropertyDirection FACING = BlockHorizontal.FACING;
          
          int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;

          boolean red = false;

          protected BlockLocationZapper() {
               super(Material.IRON);

               this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
               
               GameRegistry.registerBlock(this, "LocationZapper");
               setSoundType(SoundType.METAL);

          }

          @Override
          public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
               int i = pos.getX();
               int j = pos.getY();
               int k = pos.getZ();
               EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
               world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));
               this.setDefaultFacing(world, pos, state);
          }

          @Override
          public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
               return red ? 15 : 0;
          }

          @Override
          public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
               return red ? 15 : 0;
          }

          @Override
          public boolean isOpaqueCube(IBlockState state) {
               return false;
          }

          @SideOnly(Side.CLIENT)
          @Override
          public BlockRenderLayer getBlockLayer() {
               return BlockRenderLayer.SOLID;
          }

          @Override
          public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
               return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
          }

          @Override
          public int tickRate(World world) {
               return 10;
          }

          @Override
          public int quantityDropped(Random par1Random) {
               return 1;
          }
          
          @Override
          public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entity, EnumHand hand, ItemStack heldItem,
                    EnumFacing side, float hitX, float hitY, float hitZ) {
               int i = pos.getX();
               int j = pos.getY();
               int k = pos.getZ();
               if (true) {
                    if (entity instanceof EntityPlayer)
                         ((EntityPlayer) entity).openGui(instance, mcreator_locationZapperGUI.GUIID, world, i, j, k);
               }

               return true;
          }

               private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) {
               if (!worldIn.isRemote)
               {
               IBlockState iblockstate = worldIn.getBlockState(pos.north());
          IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
          IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
          IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
               EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
     
                 if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
                 {
                     enumfacing = EnumFacing.SOUTH;
                 }
                 else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
                 {
                     enumfacing = EnumFacing.NORTH;
                 }
                 else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
                 {
                     enumfacing = EnumFacing.EAST;
                 }
                 else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
                 {
                     enumfacing = EnumFacing.WEST;
                 }
     
                 worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
             }
         }
     }
}

LocationZapperGUI:

import org.lwjgl.input.Keyboard;

import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.FMLCommonHandler;

import net.minecraft.world.World;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.item.ItemStack;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.inventory.InventoryBasic;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Container;
import net.minecraft.init.Items;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.Minecraft;

import java.util.Random;

@SuppressWarnings("unchecked")
public class mcreator_locationZapperGUI {

    public static Object instance;

    public static int GUIID = 1;

    public mcreator_locationZapperGUI() {
    }

    public void load(FMLInitializationEvent event) {
    }

    public void registerRenderers() {
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {
    }

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
    }

    public int addFuel(ItemStack fuel) {
        return 0;
    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
    }

    public static IInventory Antennas;
    public static IInventory Emeralds;

    public static IInventory inherited;

    public static class GuiContainerMod extends Container {

        World world = null;
        EntityPlayer entity = null;
        int i, j, k;

        public GuiContainerMod(World world, int i, int j, int k, EntityPlayer player) {

            this.world = world;
            this.entity = player;
            this.i = i;
            this.j = j;
            this.k = k;

            Antennas = new InventoryBasic("Antennas", true, 1);
            Emeralds = new InventoryBasic("Emeralds", true, 1);
            this.addSlotToContainer(new Slot(Antennas, 0, 12, 12) {
                public boolean isItemValid(ItemStack stack) {
                    return ((stack != null) && stack.getItem() == mcreator_ironRod.block);
                }

                public void onSlotChanged() {
                    super.onSlotChanged();
                    if (getHasStack()) {
                        EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
                        int i = (int) entity.posX;
                        int j = (int) entity.posY;
                        int k = (int) entity.posZ;
                        MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
                        World world = server.worldServers[0];

                    }
                }
            });
            this.addSlotToContainer(new Slot(Emeralds, 1, 12, 51) {
                public boolean isItemValid(ItemStack stack) {
                    return ((stack != null) && stack.getItem() == Items.EMERALD);
                }

                public void onSlotChanged() {
                    super.onSlotChanged();
                    if (getHasStack()) {
                        EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
                        int i = (int) entity.posX;
                        int j = (int) entity.posY;
                        int k = (int) entity.posZ;
                        MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
                        World world = server.worldServers[0];

                    }
                }
            });
            bindPlayerInventory(player.inventory);

        }

        @Override
        public boolean canInteractWith(EntityPlayer player) {
            return true;
        }

        protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
            int i;
            int j;

            for (i = 0; i < 3; ++i) {
                for (j = 0; j < 9; ++j) {
                    this.addSlotToContainer(new Slot(inventoryPlayer, j + (i + 1) * 9, 8 + j * 18, 84 + i * 18));
                }
            }

            for (i = 0; i < 9; ++i) {
                this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
            }
        }

        @Override
        public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
            ItemStack itemstack = null;
            Slot slot = (Slot) this.inventorySlots.get(index);

            if (slot != null && slot.getHasStack()) {
                ItemStack itemstack1 = slot.getStack();
                itemstack = itemstack1.copy();

                if (index < 9) {
                    if (!this.mergeItemStack(itemstack1, 9, (45 - 9), true)) {// fixes
                                                                                // shiftclick
                                                                                // error
                        return null;
                    }
                } else if (!this.mergeItemStack(itemstack1, 0, 9, false)) {
                    return null;
                }

                if (itemstack1.stackSize == 0) {
                    slot.putStack((ItemStack) null);
                } else {
                    slot.onSlotChanged();
                }

                if (itemstack1.stackSize == itemstack.stackSize) {
                    return null;
                }

                slot.onPickupFromSlot(playerIn, itemstack1);
            }

            return itemstack;
        }

        public void onContainerClosed(EntityPlayer playerIn) {
            super.onContainerClosed(playerIn);

            MinecraftServer server2 = FMLCommonHandler.instance().getMinecraftServerInstance();
            World world2 = server2.worldServers[0];
            InventoryHelper.dropInventoryItems(world2, new BlockPos(i, j, k), Emeralds);

        }
    }

    public static class GuiWindow extends GuiContainer {

        int i = 0;
        int j = 0;
        int k = 0;
        EntityPlayer entity = null;

        GuiTextField X;
        GuiTextField Y;
        GuiTextField Z;

        public GuiWindow(World world, int i, int j, int k, EntityPlayer entity) {
            super(new GuiContainerMod(world, i, j, k, entity));
            this.i = i;
            this.j = j;
            this.k = k;
            this.entity = entity;
            this.xSize = 176;
            this.ySize = 166;
        }

        private static final ResourceLocation texture = new ResourceLocation("LocationZapperGUI.png");

        protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
            int posX = (this.width) / 2;
            int posY = (this.height) / 2;
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

            this.mc.renderEngine.bindTexture(texture);
            int k = (this.width - this.xSize) / 2;
            int l = (this.height - this.ySize) / 2;
            this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);

            zLevel = 100.0F;

        }

        protected void mouseClicked(int par1, int par2, int par3) throws java.io.IOException {
            super.mouseClicked(par1, par2, par3);

            this.X.mouseClicked(par1, par2, par3);
            this.Y.mouseClicked(par1, par2, par3);
            this.Z.mouseClicked(par1, par2, par3);
        }

        public void updateScreen() {
            super.updateScreen();
            int posX = (this.width) / 2;
            int posY = (this.height) / 2;

            this.X.updateCursorCounter();
            this.Y.updateCursorCounter();
            this.Z.updateCursorCounter();
        }

        @Override
        protected void keyTyped(char par1, int par2) throws java.io.IOException {

            super.keyTyped(par1, par2);

            this.X.textboxKeyTyped(par1, par2);
            this.Y.textboxKeyTyped(par1, par2);
            this.Z.textboxKeyTyped(par1, par2);

        }

        protected void drawGuiContainerForegroundLayer(int par1, int par2) {
            int posX = (this.width) / 2;
            int posY = (this.height) / 2;

            this.X.drawTextBox();
            this.Y.drawTextBox();
            this.Z.drawTextBox();
        }

        public void onGuiClosed() {
            super.onGuiClosed();
            Keyboard.enableRepeatEvents(false);
        }

        public void initGui() {
            super.initGui();
            this.guiLeft = (this.width - 176) / 2;
            this.guiTop = (this.height - 166) / 2;
            Keyboard.enableRepeatEvents(true);
            this.buttonList.clear();
            int posX = (this.width) / 2;
            int posY = (this.height) / 2;

            this.X = new GuiTextField(0, this.fontRendererObj, (49), (10), 22, 20);
            this.X.setMaxStringLength(32767);
            this.X.setFocused(true);

            this.X.setText("0");

            this.Y = new GuiTextField(1, this.fontRendererObj, (93), (10), 23, 20);
            this.Y.setMaxStringLength(32767);
            this.Y.setFocused(true);

            this.Y.setText("0");

            this.Z = new GuiTextField(2, this.fontRendererObj, (137), (10), 27, 20);
            this.Z.setMaxStringLength(32767);
            this.Z.setFocused(true);

            this.Z.setText("0");
            this.buttonList.add(new GuiButton(0, this.guiLeft + 68, this.guiTop + 48, 44, 20, "FIRE"));

        }

        protected void actionPerformed(GuiButton button) {
            MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
            World world = server.worldServers[0];

            if (button.id == 0) {

                if ((Emeralds.getStackInSlot(0) != null) && Emeralds.getStackInSlot(0).getItem() == Items.EMERALD) {
                    world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k, false));
                }

            }

        }

        public boolean doesGuiPauseGame() {
            return false;
        }

    }

}

I'm pretty sure that LocationZapper & LocationZapperGUI are causing the problem because those were what I was editing before the error, but I honestly don't know.  I would love to have help as soon as possible because I'm really excited about this mod and want to keep moving forward with it.

Thanks in advance!

Last seen on 07:04, 27. Oct 2020
Joined Jun 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
The error can be (I'm not
Mon, 02/20/2017 - 19:36

The error can be (I'm not sure, I can't code) that MCreator can't find data for elements. For fixing that, export your workspace, reinstall MCreator and import the workspace.
Remember that when you import a workspace all recipes results are 1 and mob AI and Custom Bullets are removed. You need to set the right results to recipes and to edit your guns. For the mobs I don't know.
Rember also that I don't know if it's this the error, anyways the error wrote here is the "Broken Workspace"

Last seen on 17:33, 25. Jul 2017
Joined May 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
RE:The error can be (I'm not
Tue, 02/21/2017 - 03:31

I won't have access to MCreator for a couple of days, but as soon as I get back to my computer I will try your suggesstion.  Also, this is the first time anyone has ever replied to any of my questions, so thanks for that! : )