1

[Please Help] Network Mod Issue

T3rr11's Avatar T3rr111/31/14 8:16 am
1 emeralds 352
Ok i have read up pretty much everywhere on this and cannot figure it out i keep getting this error:

A Mod tried to open a gui on the server without being a NetworkMod.

Here are my classes.

mod_Texore

Click to reveal
package net.minecraft.src;
import java.util.Map;
import java.util.Random;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.src.Armor.texArmor;
import net.minecraft.src.Biome.texBiome;
import net.minecraft.src.Block.greenScreen;
import net.minecraft.src.Block.multiScreen;
import net.minecraft.src.Block.smeltedDecBlock;
import net.minecraft.src.Block.texBlock;
import net.minecraft.src.Block.texDecorationBlock;
import net.minecraft.src.Block.texFurnace;
import net.minecraft.src.Block.texStone;
import net.minecraft.src.Block.texStrip;
import net.minecraft.src.Dimension.texDim;
import net.minecraft.src.Entity.TileEntityTexFurnace;
import net.minecraft.src.Gui.GuiHandler;
import net.minecraft.src.Item.texAxe;
import net.minecraft.src.Item.texBall;
import net.minecraft.src.Item.texIngot;
import net.minecraft.src.Item.texMultiAxe;
import net.minecraft.src.Item.texPickaxe;
import net.minecraft.src.Magic.kingNoodle;
import net.minecraft.src.Ores.texOre;
import net.minecraft.src.Tab.texTab;
import net.minecraft.world.World;

@Mod(modid = "TexMod", name = "Texore Mod", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = "TexModPacket", packetHandler = TexPacketHandler.class)

public class mod_Texore extends BaseMod
{

public String getVersion()
{
return "1.0";
}
@Instance("TexMod")
public static mod_Texore instance = new mod_Texore();
public static Block texFurnaceIdle;
public static Block texFurnaceBurning;
public void load()
{

texFurnaceIdle = new texFurnace(2001, false).setHardness(3.5F).setUnlocalizedName("texFurnaceIdle").setCreativeTab(texTab.tab); texFurnaceBurning = new texFurnace(2002, true).setHardness(3.5F).setUnlocalizedName("texFurnaceBurning").setCreativeTab(texTab.tab);

ModLoader.registerBlock(texFurnaceIdle);
ModLoader.addName(texFurnaceIdle, "Tex Furnace");
ModLoader.registerBlock(texFurnaceBurning);
ModLoader.addName(texFurnaceBurning, "Tex Furnace Burning (Dont Use)");
GameRegistry.registerTileEntity(TileEntityTexFurnace.class, "tileentitytexfurnace");
NetworkRegistry.instance().registerGuiHandler(this, new GuiHandler());
}
}


GuiHandler
Click to reveal
package net.minecraft.src.Gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.src.Block.texFurnaceContainer;
import net.minecraft.src.Entity.TileEntityTexFurnace;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class GuiHandler implements IGuiHandler{
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

TileEntity tile_entity = world.getBlockTileEntity(x, y, z);

if(tile_entity instanceof TileEntityTexFurnace){
return new texFurnaceContainer(player.inventory, (TileEntityTexFurnace) tile_entity);
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

TileEntity tile_entity = world.getBlockTileEntity(x, y, z);

if(tile_entity instanceof TileEntityTexFurnace){
return new TexGuiFurnace(player.inventory, (TileEntityTexFurnace) tile_entity);
}
return null;
}
}


texFurnace

Click to reveal
package net.minecraft.src.Block;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockFurnace;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.src.TexPacketHandler;
import net.minecraft.src.mod_Texore;
import net.minecraft.src.Entity.TileEntityTexFurnace;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class texFurnace extends BlockContainer
{
/**
* Is the random generator used by furnace to drop the inventory contents in random directions.
*/
private final Random furnaceRand = new Random();
/** True if this is an active furnace, false if idle */
private final boolean isActive;
/**
* This flag is used to prevent the furnace inventory to be dropped upon block removal, is used internally when the
* furnace block changes from idle to active and vice-versa.
*/
private static boolean keepFurnaceInventory;
@SideOnly(Side.CLIENT)
private Icon furnaceIconTop;
@SideOnly(Side.CLIENT)
private Icon furnaceIconFront;
public texFurnace(int par1, boolean par2)
{
super(par1, Material.rock);
this.isActive = par2;
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return mod_Texore.texFurnaceIdle.blockID;
}
/**
* Called whenever the block is added into the world. Args: world, x, y, z
*/
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
super.onBlockAdded(par1World, par2, par3, par4);
this.setDefaultDirection(par1World, par2, par3, par4);
}
/**
* set a blocks direction
*/
private void setDefaultDirection(World par1World, int par2, int par3, int par4)
{
if (!par1World.isRemote)
{
int l = par1World.getBlockId(par2, par3, par4 - 1);
int i1 = par1World.getBlockId(par2, par3, par4 + 1);
int j1 = par1World.getBlockId(par2 - 1, par3, par4);
int k1 = par1World.getBlockId(par2 + 1, par3, par4);
byte b0 = 3;
if (Block.opaqueCubeLookup[l] && !Block.opaqueCubeLookup[i1])
{
b0 = 3;
}
if (Block.opaqueCubeLookup[i1] && !Block.opaqueCubeLookup[l])
{
b0 = 2;
}
if (Block.opaqueCubeLookup[j1] && !Block.opaqueCubeLookup[k1])
{
b0 = 5;
}
if (Block.opaqueCubeLookup[k1] && !Block.opaqueCubeLookup[j1])
{
b0 = 4;
}
par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
}
}
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public Icon getIcon(int par1, int par2)
{
return par1 == 1 ? this.furnaceIconTop : (par1 == 0 ? this.furnaceIconTop : (par1 != par2 ? this.blockIcon : this.furnaceIconFront));
}
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("texFurnace_side");
this.furnaceIconFront = par1IconRegister.registerIcon(this.isActive ? "texFurnace_side_on" : "texFurnace_side");
this.furnaceIconTop = par1IconRegister.registerIcon("texFurnace_top");
}
/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float g, float t)
{

TileEntityTexFurnace tileentitytexfurnace = (TileEntityTexFurnace)world.getBlockTileEntity(x, y, z);
if (tileentitytexfurnace == null || player.isSneaking())
{
return false;
}
player.openGui(mod_Texore.instance, 0, world, x, y, z);
return true;
}
/**
* Update which block ID the furnace is using depending on whether or not it is burning
*/
public static void updateFurnaceBlockState(boolean par0, World par1World, int par2, int par3, int par4)
{
int l = par1World.getBlockMetadata(par2, par3, par4);
TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4);
keepFurnaceInventory = true;
if (par0)
{
par1World.setBlock(par2, par3, par4, mod_Texore.texFurnaceBurning.blockID);
}
else
{
par1World.setBlock(par2, par3, par4, mod_Texore.texFurnaceIdle.blockID);
}
keepFurnaceInventory = false;
par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);
if (tileentity != null)
{
tileentity.validate();
par1World.setBlockTileEntity(par2, par3, par4, tileentity);
}
}
@SideOnly(Side.CLIENT)
/**
* A randomly called display update to be able to add particles or other items for display
*/
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (this.isActive)
{
int l = par1World.getBlockMetadata(par2, par3, par4);
float f = (float)par2 + 0.5F;
float f1 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
float f2 = (float)par4 + 0.5F;
float f3 = 0.52F;
float f4 = par5Random.nextFloat() * 0.6F - 0.3F;
if (l == 4)
{
par1World.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
}
else if (l == 5)
{
par1World.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D);
}
else if (l == 2)
{
par1World.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D);
}
else if (l == 3)
{
par1World.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
par1World.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D);
}
}
}
/**
* Returns a new instance of a block's tile entity class. Called on placing the block.
*/
public TileEntity createNewTileEntity(World par1World)
{
return new TileEntityTexFurnace();
}
/**
* Called when the block is placed in the world.
*/
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
{
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (l == 0)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2);
}
if (l == 1)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2);
}
if (l == 2)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2);
}
if (l == 3)
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2);
}
if (par6ItemStack.hasDisplayName())
{
((TileEntityTexFurnace)par1World.getBlockTileEntity(par2, par3, par4)).setGuiDisplayName(par6ItemStack.getDisplayName());
}
}
/**
* Called on server worlds only when the block has been replaced by a different block ID, or the same block with a
* different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old
* metadata
*/
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
{
if (!keepFurnaceInventory)
{
TileEntityTexFurnace tileentityfurnace = (TileEntityTexFurnace)par1World.getBlockTileEntity(par2, par3, par4);
if (tileentityfurnace != null)
{
for (int j1 = 0; j1 < tileentityfurnace.getSizeInventory(); ++j1)
{
ItemStack itemstack = tileentityfurnace.getStackInSlot(j1);
if (itemstack != null)
{
float f = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
float f1 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
float f2 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
while (itemstack.stackSize > 0)
{
int k1 = this.furnaceRand.nextInt(21) + 10;
if (k1 > itemstack.stackSize)
{
k1 = itemstack.stackSize;
}
itemstack.stackSize -= k1;
EntityItem entityitem = new EntityItem(par1World, (double)((float)par2 + f), (double)((float)par3 + f1), (double)((float)par4 + f2), new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));
if (itemstack.hasTagCompound())
{
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
}
float f3 = 0.05F;
entityitem.motionX = (double)((float)this.furnaceRand.nextGaussian() * f3);
entityitem.motionY = (double)((float)this.furnaceRand.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = (double)((float)this.furnaceRand.nextGaussian() * f3);
par1World.spawnEntityInWorld(entityitem);
}
}
}
par1World.func_96440_m(par2, par3, par4, par5);
}
}
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
/**
* If this returns true, then comparators facing away from this block will use the value from
* getComparatorInputOverride instead of the actual redstone signal strength.
*/
public boolean hasComparatorInputOverride()
{
return true;
}
/**
* If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal
* strength when this block inputs to a comparator.
*/
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5)
{
return Container.calcRedstoneFromInventory((IInventory)par1World.getBlockTileEntity(par2, par3, par4));
}
@SideOnly(Side.CLIENT)
/**
* only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
*/
public int idPicked(World par1World, int par2, int par3, int par4)
{
return mod_Texore.texFurnaceIdle.blockID;
}
}


If you need more please ask, i need help,, the block is in the game just when you right click it keeps throwing that error.
Posted by T3rr11's Avatar
T3rr11
Level 33 : Artisan Modder
14

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome