more hadron work
@ -270,6 +270,13 @@ fluid.acid_fluid=Säure
|
||||
fluid.mud_fluid=Giftiger Schlamm
|
||||
fluid.toxic_fluid=Stereotypischer grüner Schleim
|
||||
|
||||
hadron.analysis=Analysiere...
|
||||
hadron.buttonOn=Analysekammer (falls vorhanden) ist AN
|
||||
hadron.buttonOff=Analysekammer ist AUS
|
||||
hadron.error=Fehler!
|
||||
hadron.idle=Leerlauf
|
||||
hadron.progress=Verarbeite...
|
||||
|
||||
hbmfluid.acid=Wasserstoffperoxid
|
||||
hbmfluid.amat=Antimaterie
|
||||
hbmfluid.aschrab=Antischrabidium
|
||||
|
||||
@ -270,6 +270,13 @@ fluid.acid_fluid=Acid
|
||||
fluid.mud_fluid=Poisonous Mud
|
||||
fluid.toxic_fluid=Stereotypical Green Ooze
|
||||
|
||||
hadron.analysis=Analyzing...
|
||||
hadron.buttonOn=Analysis Chamber (if present) is ON
|
||||
hadron.buttonOff=Analysis Chamber is OFF
|
||||
hadron.error=Error!
|
||||
hadron.idle=Idle
|
||||
hadron.progress=In Progress...
|
||||
|
||||
hbmfluid.acid=Hydrogen Peroxide
|
||||
hbmfluid.amat=Antimatter
|
||||
hbmfluid.aschrab=Antischrabidium
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
BIN
src/main/java/assets/hbm/textures/gui/machine/gui_hadron.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
src/main/java/assets/hbm/textures/items/particle_amat.png
Normal file
|
After Width: | Height: | Size: 247 B |
BIN
src/main/java/assets/hbm/textures/items/particle_aschrab.png
Normal file
|
After Width: | Height: | Size: 255 B |
BIN
src/main/java/assets/hbm/textures/items/particle_dark.png
Normal file
|
After Width: | Height: | Size: 247 B |
BIN
src/main/java/assets/hbm/textures/items/particle_empty.png
Normal file
|
After Width: | Height: | Size: 233 B |
BIN
src/main/java/assets/hbm/textures/items/particle_higgs.png
Normal file
|
After Width: | Height: | Size: 289 B |
BIN
src/main/java/assets/hbm/textures/items/particle_sparkticle.png
Normal file
|
After Width: | Height: | Size: 287 B |
BIN
src/main/java/assets/hbm/textures/items/particle_strange.png
Normal file
|
After Width: | Height: | Size: 274 B |
@ -460,6 +460,7 @@ public class ModBlocks {
|
||||
public static Block hadron_analysis_glass;
|
||||
public static Block hadron_access;
|
||||
public static Block hadron_core;
|
||||
public static final int guiID_hadron = 101;
|
||||
|
||||
public static Block machine_electric_furnace_off;
|
||||
public static Block machine_electric_furnace_on;
|
||||
@ -1198,26 +1199,15 @@ public class ModBlocks {
|
||||
hadron_plating_striped = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_striped").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating_striped");
|
||||
hadron_plating_voltz = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_voltz").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating_voltz");
|
||||
hadron_plating_glass = new BlockNTMGlass(RefStrings.MODID + ":hadron_plating_glass", Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_plating_glass").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_plating_glass");
|
||||
hadron_coil_alloy = new BlockHadronCoil(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_alloy").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_alloy");
|
||||
hadron_coil_schrabidium = new BlockHadronCoil(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_schrabidium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_schrabidium");
|
||||
hadron_coil_starmetal = new BlockHadronCoil(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_starmetal").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_starmetal");
|
||||
hadron_coil_alloy = new BlockHadronCoil(Material.iron, 1).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_alloy").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_alloy");
|
||||
hadron_coil_schrabidium = new BlockHadronCoil(Material.iron, 3).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_schrabidium").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_schrabidium");
|
||||
hadron_coil_starmetal = new BlockHadronCoil(Material.iron, 10).setStepSound(Block.soundTypeMetal).setBlockName("hadron_coil_starmetal").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_coil_starmetal");
|
||||
hadron_power = new BlockHadronPower(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_power").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_power");
|
||||
hadron_diode = new BlockHadronDiode(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_diode").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
hadron_analysis = new BlockHadronPlating(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_analysis").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_analysis");
|
||||
hadron_analysis_glass = new BlockNTMGlass(RefStrings.MODID + ":hadron_analysis_glass", Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_analysis_glass").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_analysis_glass");
|
||||
|
||||
/*public static Block hadron_plating;
|
||||
public static Block hadron_plating_blue;
|
||||
public static Block hadron_plating_black;
|
||||
public static Block hadron_plating_yellow;
|
||||
public static Block hadron_plating_striped;
|
||||
public static Block hadron_plating_glass;
|
||||
public static Block hadron_plating_voltz;
|
||||
public static Block hadron_coil_alloy;
|
||||
public static Block hadron_coil_schrabidium;
|
||||
public static Block hadron_coil_starmetal;
|
||||
public static Block hadron_power;
|
||||
public static Block hadron_access;
|
||||
public static Block hadron_core;*/
|
||||
hadron_access = new BlockHadronAccess(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_access").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_access");
|
||||
hadron_core = new BlockHadronCore(Material.iron).setStepSound(Block.soundTypeMetal).setBlockName("hadron_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":hadron_core");
|
||||
|
||||
machine_electric_furnace_off = new MachineElectricFurnace(false).setBlockName("machine_electric_furnace_off").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_electric_furnace_on = new MachineElectricFurnace(true).setBlockName("machine_electric_furnace_on").setHardness(5.0F).setLightLevel(1.0F).setResistance(10.0F);
|
||||
@ -1990,9 +1980,12 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(hadron_coil_alloy, hadron_coil_alloy.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_coil_schrabidium, hadron_coil_schrabidium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_coil_starmetal, hadron_coil_starmetal.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_power, hadron_power.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_diode, hadron_diode.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_analysis, hadron_analysis.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_analysis_glass, hadron_analysis_glass.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_access, hadron_access.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(hadron_core, hadron_core.getUnlocalizedName());
|
||||
|
||||
/*public static Block hadron_plating;
|
||||
public static Block hadron_plating_blue;
|
||||
|
||||
63
src/main/java/com/hbm/blocks/machine/BlockHadronAccess.java
Normal file
@ -0,0 +1,63 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockHadronAccess extends Block {
|
||||
|
||||
public BlockHadronAccess(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
|
||||
if(side != meta)
|
||||
return ModBlocks.hadron_plating_blue.getIcon(side, meta);
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
|
||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, l, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite();
|
||||
|
||||
for(int i = 1; i < 3; i++) {
|
||||
|
||||
if(world.getBlock(x + dir.offsetX * i, y + dir.offsetY * i, z + dir.offsetZ * i) == ModBlocks.hadron_core) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_hadron, world, x + dir.offsetX * i, y + dir.offsetY * i, z + dir.offsetZ * i);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,8 +4,11 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockHadronCoil extends Block {
|
||||
|
||||
public int factor;
|
||||
|
||||
public BlockHadronCoil(Material mat) {
|
||||
public BlockHadronCoil(Material mat, int factor) {
|
||||
super(mat);
|
||||
this.factor = factor;
|
||||
}
|
||||
}
|
||||
|
||||
83
src/main/java/com/hbm/blocks/machine/BlockHadronCore.java
Normal file
@ -0,0 +1,83 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityHadron;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockHadronCore extends BlockContainer {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconIn;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconOut;
|
||||
|
||||
public BlockHadronCore(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityHadron();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
super.registerBlockIcons(iconRegister);
|
||||
this.iconIn = iconRegister.registerIcon(RefStrings.MODID + ":hadron_core_in");
|
||||
this.iconOut = iconRegister.registerIcon(RefStrings.MODID + ":hadron_core_out");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
|
||||
if(side == meta)
|
||||
return this.iconOut;
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
|
||||
if(side == dir.getOpposite().ordinal())
|
||||
return this.iconIn;
|
||||
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
|
||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, l, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote) {
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
TileEntityHadron entity = (TileEntityHadron) world.getTileEntity(x, y, z);
|
||||
if(entity != null) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_hadron, world, x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityHadronDiode;
|
||||
|
||||
20
src/main/java/com/hbm/blocks/machine/BlockHadronPower.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityHadronPower;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHadronPower extends BlockContainer {
|
||||
|
||||
public BlockHadronPower(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityHadronPower();
|
||||
}
|
||||
}
|
||||
@ -905,6 +905,15 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_hadron:
|
||||
{
|
||||
if(entity instanceof TileEntityHadron)
|
||||
{
|
||||
return new ContainerHadron(player.inventory, (TileEntityHadron) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//NON-TE CONTAINERS
|
||||
@ -1800,6 +1809,15 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_hadron:
|
||||
{
|
||||
if(entity instanceof TileEntityHadron)
|
||||
{
|
||||
return new GUIHadron(player.inventory, (TileEntityHadron) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//ITEM GUIS
|
||||
|
||||
@ -185,8 +185,8 @@ public class ShredderRecipes {
|
||||
ShredderRecipes.setRecipe(ModItems.coil_copper_torus, new ItemStack(ModItems.powder_red_copper, 2));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_advanced_alloy, new ItemStack(ModItems.powder_advanced_alloy, 1));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_advanced_torus, new ItemStack(ModItems.powder_advanced_alloy, 2));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_gold, new ItemStack(ModItems.powder_advanced_alloy, 1));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_gold_torus, new ItemStack(ModItems.powder_advanced_alloy, 2));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_gold, new ItemStack(ModItems.powder_gold, 1));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_gold_torus, new ItemStack(ModItems.powder_gold, 2));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_tungsten, new ItemStack(ModItems.powder_tungsten, 1));
|
||||
ShredderRecipes.setRecipe(ModItems.coil_magnetized_tungsten, new ItemStack(ModItems.powder_magnetized_tungsten, 1));
|
||||
|
||||
|
||||
@ -0,0 +1,84 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotMachineOutput;
|
||||
import com.hbm.tileentity.machine.TileEntityHadron;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerHadron extends Container {
|
||||
|
||||
private TileEntityHadron hadron;
|
||||
|
||||
public ContainerHadron(InventoryPlayer invPlayer, TileEntityHadron tedf) {
|
||||
|
||||
hadron = tedf;
|
||||
|
||||
//Input
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 26, 36));
|
||||
//Output
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 1, 134, 36));
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 44, 108));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + (18 * 3) + 2));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + (18 * 3) + 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 2) {
|
||||
if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
} else if (!this.mergeItemStack(var5, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return hadron.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
70
src/main/java/com/hbm/inventory/gui/GUIHadron.java
Normal file
@ -0,0 +1,70 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerHadron;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.AuxButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.machine.TileEntityHadron;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIHadron extends GuiInfoContainer {
|
||||
|
||||
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_hadron.png");
|
||||
private TileEntityHadron hadron;
|
||||
|
||||
public GUIHadron(InventoryPlayer invPlayer, TileEntityHadron laser) {
|
||||
super(new ContainerHadron(invPlayer, laser));
|
||||
this.hadron = laser;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 71, guiTop + 108, 34, 16, hadron.power, hadron.maxPower);
|
||||
|
||||
//String text = "Magnets are " + ((iter.isOn && iter.power >= iter.powerReq) ? "ON" : "OFF");
|
||||
//this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 76, guiTop + 94, 24, 12, mouseX, mouseY, new String[] { text });
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
//Toggle hadron
|
||||
if(guiLeft + 19 <= x && guiLeft + 19 + 18 > x && guiTop + 89 < y && guiTop + 89 + 18 >= y) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(hadron.xCoord, hadron.yCoord, hadron.zCoord, 0, 0));
|
||||
}
|
||||
|
||||
//Toggle analysis chamber
|
||||
if(guiLeft + 142 <= x && guiLeft + 142 + 18 > x && guiTop + 89 < y && guiTop + 89 + 18 >= y) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(hadron.xCoord, hadron.yCoord, hadron.zCoord, 0, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.hadron.hasCustomInventoryName() ? this.hadron.getInventoryName() : I18n.format(this.hadron.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
126
src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java
Normal file
@ -0,0 +1,126 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityHadron extends TileEntityMachineBase implements IConsumer {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000000;
|
||||
|
||||
public boolean isOn = false;
|
||||
public boolean analysis = true;
|
||||
|
||||
public TileEntityHadron() {
|
||||
super(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "container.hadron";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
drawPower();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleButtonPacket(int value, int meta) {
|
||||
|
||||
if(meta == 0)
|
||||
this.isOn = !this.isOn;
|
||||
if(meta == 1)
|
||||
this.analysis = !this.analysis;
|
||||
}
|
||||
|
||||
private void drawPower() {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
||||
if(power == maxPower)
|
||||
return;
|
||||
|
||||
int x = xCoord + dir.offsetX * 2;
|
||||
int y = yCoord + dir.offsetY * 2;
|
||||
int z = zCoord + dir.offsetZ * 2;
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof TileEntityHadronPower) {
|
||||
|
||||
TileEntityHadronPower plug = (TileEntityHadronPower)te;
|
||||
|
||||
long toDraw = Math.min(maxPower - power, plug.getPower());
|
||||
this.setPower(power + toDraw);
|
||||
plug.setPower(plug.getPower() - toDraw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final int maxParticles = 1;
|
||||
List<Particle> particles = new ArrayList();
|
||||
|
||||
private void updateParticle() {
|
||||
|
||||
for(Particle particle : particles) {
|
||||
particle.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
public static class Particle {
|
||||
|
||||
//Starting values
|
||||
Item item;
|
||||
ForgeDirection dir;
|
||||
int posX;
|
||||
int posY;
|
||||
int posZ;
|
||||
|
||||
//Progressing values
|
||||
int momentum;
|
||||
int charge;
|
||||
|
||||
public Particle(Item item, ForgeDirection dir, int posX, int posY, int posZ) {
|
||||
this.item = item;
|
||||
this.dir = dir;
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
|
||||
this.charge = 10;
|
||||
this.momentum = 0;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityHadronPower extends TileEntity implements IConsumer {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000000;
|
||||
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
}
|
||||