Position this mod as a port of CE instead of BCx. - Rename the mod to CE-modern (modid cemodern) and the package to net.kanawo.cemodern; the main class is now CEModern. - Move assets to assets/cemodern and rename the lang key and EMC save data to match. - Describe the mod as a port of CE in the README and mcmod.info. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.2 KiB
Java
35 lines
1.2 KiB
Java
package net.kanawo.cemodern.gui;
|
|
|
|
import net.kanawo.cemodern.tile.TileEMCBuilder;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.world.World;
|
|
|
|
import cpw.mods.fml.common.network.IGuiHandler;
|
|
|
|
public class GuiHandler implements IGuiHandler {
|
|
|
|
public static final int EMC_BUILDER = 0;
|
|
|
|
@Override
|
|
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
|
TileEMCBuilder builder = getBuilder(id, world, x, y, z);
|
|
return builder == null ? null : new ContainerEMCBuilder(player.inventory, builder);
|
|
}
|
|
|
|
@Override
|
|
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
|
TileEMCBuilder builder = getBuilder(id, world, x, y, z);
|
|
return builder == null ? null : new GuiEMCBuilder(player.inventory, builder);
|
|
}
|
|
|
|
private static TileEMCBuilder getBuilder(int id, World world, int x, int y, int z) {
|
|
if (id != EMC_BUILDER || !world.blockExists(x, y, z)) {
|
|
return null;
|
|
}
|
|
|
|
TileEntity tile = world.getTileEntity(x, y, z);
|
|
return tile instanceof TileEMCBuilder ? (TileEMCBuilder) tile : null;
|
|
}
|
|
}
|