jopi
Попрошайка
- 1,421
- 30
- 260
В общем я обосрался и оно не работает.
гуи не открывается, хотя на 1.5.2 все работало.
Не открывается гуи, в блоке стоят проверки и при нажатии на блок вижу [INFO] [STDOUT] govnox2
гуи не открывается, хотя на 1.5.2 все работало.
Не открывается гуи, в блоке стоят проверки и при нажатии на блок вижу [INFO] [STDOUT] govnox2
Java:
package hardpla;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import hardpla.handlers.EventHandlerClient;
import hardpla.handlers.EventHandlerServer;
import hardpla.handlers.GameProcessHandler;
import hardpla.handlers.Proxy;
import net.minecraftforge.common.MinecraftForge;
@Mod(modid = "hardpla", name = "Hardpla mod", version = Hardpla.VER)
@NetworkMod(clientSideRequired = false, serverSideRequired = true)
public class Hardpla {
public static final String VER = "0.0.001";
@Instance("hardpla")
public static Hardpla instance;
@SidedProxy(clientSide = "hardpla.handlers.ClientProxy", serverSide = "hardpla.handlers.Proxy")
public static Proxy proxy;
public Utils util;
public EventHandlerServer handler;
public EventHandlerClient handlerClient;
public GameProcessHandler gameHandler;
public ItemReg items;
public BlockReg blocks;
@EventHandler
public void preInit(FMLPreInitializationEvent e) {
this.util = new Utils();
this.handler = new EventHandlerServer();
this.handlerClient = new EventHandlerClient();
this.gameHandler = new GameProcessHandler().register();
this.items = new ItemReg();
this.blocks = new BlockReg();
MinecraftForge.EVENT_BUS.register(this.handler);
MinecraftForge.EVENT_BUS.register(this.handlerClient);
MinecraftForge.EVENT_BUS.register(this.gameHandler);
proxy.register();
NetworkRegistry.instance().registerGuiHandler(Hardpla.instance, proxy);
}
@EventHandler
public void init(FMLInitializationEvent e) {
this.items.init();
this.blocks.init();
this.gameHandler.removeRecipes();
this.gameHandler.registerRecipes();
}
}
Java:
package hardpla.handlers;
import cpw.mods.fml.common.network.IGuiHandler;
import hardpla.blocks.container.ContainerRecoveryPlant;
import hardpla.blocks.container.TestCont;
import hardpla.blocks.tile.TestTile;
import hardpla.blocks.tile.TileRecoveryPlant;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class Proxy implements IGuiHandler {
public void register() {
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile;
System.out.println("sest");
switch(ID) {
case 500:
tile = world.getBlockTileEntity(x, y, z);
if(tile instanceof TestTile) {
return new TestCont(player.inventory, (TestTile)tile);
}
break;
case 501:
tile = world.getBlockTileEntity(x, y, z);
System.out.println("ese");
if(tile instanceof TileRecoveryPlant) {
return new ContainerRecoveryPlant(player.inventory, (TileRecoveryPlant)tile);
}
break;
}
System.out.println("eye");
return null;
}
@Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; }
}
Код:
package hardpla.blocks;
import java.util.Random;
import hardpla.Hardpla;
import hardpla.ItemReg;
import hardpla.Utils;
import hardpla.blocks.tile.TileRecoveryPlant;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockRecoveryPlant extends BlockBase {
public BlockRecoveryPlant(int id) {
super(id);
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (!par1World.isRemote && !par5EntityPlayer.isSneaking()) {
TileRecoveryPlant var10 = (TileRecoveryPlant) par1World.getBlockTileEntity(par2, par3, par4);
if (var10 != null) {
if (!var10.hasPlayer) {
System.out.println("govnox2");
par5EntityPlayer.openGui(Hardpla.instance, 501, par1World, par2, par3, par4);
return true;
} else System.out.println("govno");
}
}
return false;
}
public int idDropped(int par1, Random par2Random, int par3) {
return 0;
}
public int quantityDropped(Random par1Random) {
return 0;
}
public TileEntity createNewTileEntity(World world) {
return null;
}
public TileEntity createTileEntity(World world, int metadata) {
return new TileRecoveryPlant();
}
public int getRenderType() {
return -1;
}
public boolean isOpaqueCube() {
return false;
}
public void registerIcons(IconRegister par1IconRegister) {
super.blockIcon = par1IconRegister.registerIcon("hardpla:test");
}
}
Java:
package hardpla.handlers;
import hardpla.blocks.gui.GuiRecoveryPlant;
import hardpla.blocks.gui.TestGui;
import hardpla.blocks.tile.TestTile;
import hardpla.blocks.tile.TileRecoveryPlant;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class ClientProxy extends Proxy {
public void register() {
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile;
switch(ID) {
case 500:
tile = world.getBlockTileEntity(x, y, z);
if(tile instanceof TestTile) {
return new TestGui(player.inventory, (TestTile)tile);
}
break;
case 501:
tile = world.getBlockTileEntity(x, y, z);
if(tile instanceof TileRecoveryPlant) {
return new GuiRecoveryPlant(player.inventory, (TileRecoveryPlant)tile);
}
break;
}
return null;
}
@Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; }
}
- Краш-лог
-
[INFO] [STDOUT] govnox2
Краш-лог:
[INFO] [STDOUT] govnox2