mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
ok that's it i've had enough
This commit is contained in:
parent
7b80e9fb64
commit
ccc80781b2
@ -1042,6 +1042,7 @@ public class ModBlocks {
|
||||
public static Block machine_keyforge;
|
||||
|
||||
public static Block machine_armor_table;
|
||||
public static Block machine_weapon_table;
|
||||
|
||||
public static Block reactor_research;
|
||||
public static Block reactor_zirnox;
|
||||
@ -1966,6 +1967,7 @@ public class ModBlocks {
|
||||
machine_satlinker = new MachineSatLinker(Material.iron).setBlockName("machine_satlinker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_satlinker_side");
|
||||
machine_keyforge = new MachineKeyForge(Material.iron).setBlockName("machine_keyforge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":machine_keyforge_side");
|
||||
machine_armor_table = new BlockArmorTable(Material.iron).setBlockName("machine_armor_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab);
|
||||
machine_weapon_table = new BlockWeaponTable().setBlockName("machine_weapon_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab);
|
||||
|
||||
machine_solar_boiler = new MachineSolarBoiler(Material.iron).setBlockName("machine_solar_boiler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_solar_boiler");
|
||||
solar_mirror = new SolarMirror(Material.iron).setBlockName("solar_mirror").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":solar_mirror");
|
||||
@ -3286,6 +3288,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_satlinker, machine_satlinker.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_keyforge, machine_keyforge.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_armor_table, machine_armor_table.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_weapon_table, machine_weapon_table.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_forcefield, machine_forcefield.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(radiorec, radiorec.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(radiobox, radiobox.getUnlocalizedName());
|
||||
|
||||
62
src/main/java/com/hbm/blocks/machine/BlockWeaponTable.java
Normal file
62
src/main/java/com/hbm/blocks/machine/BlockWeaponTable.java
Normal file
@ -0,0 +1,62 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.inventory.container.ContainerWeaponTable;
|
||||
import com.hbm.inventory.gui.GUIWeaponTable;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
|
||||
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.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockWeaponTable extends Block implements IGUIProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT) private IIcon iconTop;
|
||||
@SideOnly(Side.CLIENT) private IIcon iconBottom;
|
||||
|
||||
public BlockWeaponTable() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":armor_table_top");
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":armor_table_bottom");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":armor_table_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return side == 0 ? this.iconBottom : (side == 1 ? this.iconTop : this.blockIcon);
|
||||
}
|
||||
|
||||
@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()) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerWeaponTable(player.inventory); }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIWeaponTable(player.inventory); }
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryBasic;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerWeaponTable extends Container {
|
||||
|
||||
public InventoryBasic mods = new InventoryBasic("Mods", false, 7);
|
||||
public IInventory gun = new InventoryCraftResult();
|
||||
|
||||
public ContainerWeaponTable(InventoryPlayer inventory) {
|
||||
|
||||
for(int i = 0; i < 7; i++) this.addSlotToContainer(new ModSlot(mods, i, 44 + 18 * i, 108));
|
||||
|
||||
this.addSlotToContainer(new Slot(gun, 0, 8, 108) {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return stack.getItem() instanceof ItemGunBaseNT;
|
||||
}
|
||||
});
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18 + 22, 158 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18 + 22, 216));
|
||||
}
|
||||
|
||||
this.onCraftMatrixChanged(this.mods);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public class ModSlot extends Slot {
|
||||
|
||||
public ModSlot(IInventory inventory, int index, int x, int y) {
|
||||
super(inventory, index, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
41
src/main/java/com/hbm/inventory/gui/GUIWeaponTable.java
Normal file
41
src/main/java/com/hbm/inventory/gui/GUIWeaponTable.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerWeaponTable;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIWeaponTable extends GuiInfoContainer {
|
||||
|
||||
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_armor_modifier.png");
|
||||
public int left;
|
||||
public int top;
|
||||
|
||||
public GUIWeaponTable(InventoryPlayer player) {
|
||||
super(new ContainerWeaponTable(player));
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 240;
|
||||
|
||||
guiLeft = (this.width - this.xSize) / 2;
|
||||
guiTop = (this.height - this.ySize) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mX, int mY) {
|
||||
|
||||
String name = I18n.format("container.armorTable");
|
||||
this.fontRendererObj.drawString(name, (this.xSize - 22) / 2 - this.fontRendererObj.getStringWidth(name) / 2 + 22, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8 + 22, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float inter, int mX, int mY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user