laset det & airstrike recipes, proper turret player sys
@ -244,6 +244,8 @@ tile.machine_radar.name=Radar
|
||||
container.radar=Radar
|
||||
tile.machine_satlinker.name=Satelliten-ID-Manager
|
||||
container.satLinker=SatLink-Gerät
|
||||
tile.machine_telelinker.name=Geschütz-Telemetrie-Manager
|
||||
container.teleLinker=TelLink-Gerät
|
||||
|
||||
item.turret_control.name=Geschützsteuerung
|
||||
item.turret_chip.name=Geschütz-KI-Chip
|
||||
@ -252,7 +254,7 @@ item.turret_biometry.name=Geschütz-Telemetriekarte
|
||||
tile.mine_ap.name=Antipersonenmine
|
||||
tile.mine_he.name=Antipanzermine
|
||||
tile.mine_shrap.name=Schrapnellmine
|
||||
tile.mine_fat.name=Fat Mine
|
||||
tile.mine_fat.name=Fatmine
|
||||
item.defuser.name=High-Tech Bombenentschärfungsgerät
|
||||
|
||||
tile.bomb_multi.name=Mehrzweckbombe
|
||||
|
||||
@ -257,6 +257,8 @@ tile.machine_radar.name=Radar
|
||||
container.radar=Radar
|
||||
tile.machine_satlinker.name=Satellite ID Manager
|
||||
container.satLinker=SatLink Device
|
||||
tile.machine_telelinker.name=Turret Telemetry Linker
|
||||
container.teleLinker=TelLink Device
|
||||
|
||||
item.turret_control.name=Turret Controller
|
||||
item.turret_chip.name=Turret AI-Chip
|
||||
|
||||
BIN
assets/hbm/textures/blocks/machine_telelinker_side.png
Normal file
|
After Width: | Height: | Size: 559 B |
BIN
assets/hbm/textures/blocks/machine_telelinker_top.png
Normal file
|
After Width: | Height: | Size: 531 B |
BIN
assets/hbm/textures/gui/gui_telelinker.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.9 KiB |
BIN
assets/hbm/textures/items/damocles.png
Normal file
|
After Width: | Height: | Size: 360 B |
BIN
assets/hbm/textures/items/damocles_alt.png
Normal file
|
After Width: | Height: | Size: 396 B |
BIN
assets/hbm/textures/items/mentats.png
Normal file
|
After Width: | Height: | Size: 505 B |
BIN
assets/hbm/textures/items/mentats_partytime.png
Normal file
|
After Width: | Height: | Size: 462 B |
@ -457,6 +457,9 @@ public class ModBlocks {
|
||||
public static Block machine_satlinker;
|
||||
public static final int guiID_satlinker = 64;
|
||||
|
||||
public static Block machine_telelinker;
|
||||
public static final int guiID_telelinker = 68;
|
||||
|
||||
public static Block machine_reactor_small;
|
||||
public static final int guiID_reactor_small = 65;
|
||||
|
||||
@ -789,6 +792,7 @@ public class ModBlocks {
|
||||
machine_transformer = new MachineTransformer(Material.iron).setBlockName("machine_transformer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_transformer");
|
||||
|
||||
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_telelinker = new MachineTeleLinker(Material.iron).setBlockName("machine_telelinker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":machine_telelinker_side");
|
||||
|
||||
factory_titanium_hull = new BlockGeneric(Material.iron).setBlockName("factory_titanium_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_titanium_hull");
|
||||
factory_titanium_furnace = new FactoryHatch(Material.iron).setBlockName("factory_titanium_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_titanium_furnace");
|
||||
@ -1254,6 +1258,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_combine_factory, machine_combine_factory.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_teleporter, machine_teleporter.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_satlinker, machine_satlinker.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_telelinker, machine_telelinker.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(radiorec, radiorec.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(radiobox, radiobox.getUnlocalizedName());
|
||||
|
||||
|
||||
130
com/hbm/blocks/machine/MachineTeleLinker.java
Normal file
@ -0,0 +1,130 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineShredder;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTeleLinker;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSatLinker;
|
||||
|
||||
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.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineTeleLinker extends BlockContainer {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private Random rand;
|
||||
private static boolean keepInventory;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
public MachineTeleLinker(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineTeleLinker();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_telelinker_top");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_telelinker_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return side == 1 ? this.iconTop : (side == 0 ? 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())
|
||||
{
|
||||
TileEntityMachineTeleLinker entity = (TileEntityMachineTeleLinker) world.getTileEntity(x, y, z);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_telelinker, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
ISidedInventory tileentityfurnace = (ISidedInventory)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if (tileentityfurnace != null)
|
||||
{
|
||||
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
}
|
||||
@ -61,6 +61,7 @@ import com.hbm.tileentity.machine.TileEntityMachineSchrabidiumTransmutator;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineShredder;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSiren;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTeleLinker;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTeleporter;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineUF6Tank;
|
||||
@ -668,6 +669,15 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_telelinker:
|
||||
{
|
||||
if(entity instanceof TileEntityMachineTeleLinker)
|
||||
{
|
||||
return new ContainerMachineTeleLinker(player.inventory, (TileEntityMachineTeleLinker) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -1263,6 +1273,15 @@ public class GUIHandler implements IGuiHandler {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_telelinker:
|
||||
{
|
||||
if(entity instanceof TileEntityMachineTeleLinker)
|
||||
{
|
||||
return new GUIMachineTeleLinker(player.inventory, (TileEntityMachineTeleLinker) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//CLIENTONLY GUIS
|
||||
|
||||
83
com/hbm/inventory/container/ContainerMachineTeleLinker.java
Normal file
@ -0,0 +1,83 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSatLinker;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTeleLinker;
|
||||
|
||||
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 ContainerMachineTeleLinker extends Container {
|
||||
|
||||
private TileEntityMachineTeleLinker diFurnace;
|
||||
|
||||
public ContainerMachineTeleLinker(InventoryPlayer invPlayer, TileEntityMachineTeleLinker tedf) {
|
||||
|
||||
diFurnace = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 44, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 80, 35));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 116, 35));
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@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 <= 0) {
|
||||
if (!this.mergeItemStack(var5, 1, 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 diFurnace.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
56
com/hbm/inventory/gui/GUIMachineTeleLinker.java
Normal file
@ -0,0 +1,56 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineTeleLinker;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTeleLinker;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineTeleLinker extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_telelinker.png");
|
||||
private TileEntityMachineTeleLinker siren;
|
||||
|
||||
public GUIMachineTeleLinker(InventoryPlayer invPlayer, TileEntityMachineTeleLinker tedf) {
|
||||
super(new ContainerMachineTeleLinker(invPlayer, tedf));
|
||||
siren = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
String[] text = new String[] { "The first slot will copy the turret chip's",
|
||||
"UUIDs and add them to the second slot." };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
|
||||
|
||||
String[] text1 = new String[] { "The third slot will clear the",
|
||||
"turret chip's UUID list."};
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.siren.hasCustomInventoryName() ? this.siren.getInventoryName() : I18n.format(this.siren.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);
|
||||
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
|
||||
}
|
||||
}
|
||||
@ -12,13 +12,17 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import scala.actors.threadpool.Arrays;
|
||||
|
||||
public class ItemTurretBiometry extends Item {
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool)
|
||||
{
|
||||
list.add("Channel set to " + getFreq(itemstack));
|
||||
String[] names = getNames(itemstack);
|
||||
if(names != null)
|
||||
for(int i = 0; i < names.length; i++)
|
||||
list.add(names[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -26,22 +30,10 @@ public class ItemTurretBiometry extends Item {
|
||||
|
||||
int i = 0;
|
||||
|
||||
if(player.isSneaking()) {
|
||||
i = (getFreq(stack) - 1);
|
||||
} else {
|
||||
i = (getFreq(stack) + 1);
|
||||
}
|
||||
|
||||
if(i == -1)
|
||||
i = 511;
|
||||
|
||||
if(i == 512)
|
||||
i = 0;
|
||||
|
||||
setFreq(stack, i);
|
||||
addName(stack, player.getUniqueID().toString());
|
||||
|
||||
if(world.isRemote)
|
||||
player.addChatMessage(new ChatComponentText("Channel set to " + i));
|
||||
player.addChatMessage(new ChatComponentText("Added player data!"));
|
||||
|
||||
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||
|
||||
@ -50,18 +42,48 @@ public class ItemTurretBiometry extends Item {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static int getFreq(ItemStack stack) {
|
||||
public static String[] getNames(ItemStack stack) {
|
||||
if(stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
return stack.stackTagCompound.getInteger("freq");
|
||||
|
||||
String[] names = new String [stack.stackTagCompound.getInteger("playercount")];
|
||||
|
||||
for(int i = 0; i < names.length; i++) {
|
||||
names[i] = stack.stackTagCompound.getString("player_" + i);
|
||||
}
|
||||
|
||||
if(names.length == 0)
|
||||
return null;
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
private static void setFreq(ItemStack stack, int i) {
|
||||
public static void addName(ItemStack stack, String s) {
|
||||
if(stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
stack.stackTagCompound.setInteger("freq", i);
|
||||
|
||||
String[] names = getNames(stack);
|
||||
int count = 0;
|
||||
|
||||
if(names != null && Arrays.asList(names).contains(s))
|
||||
return;
|
||||
|
||||
if(names != null)
|
||||
count = names.length;
|
||||
|
||||
stack.stackTagCompound.setInteger("playercount", count + 1);
|
||||
|
||||
stack.stackTagCompound.setString("player_" + count, s);
|
||||
}
|
||||
|
||||
public static void clearNames(ItemStack stack) {
|
||||
if(stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
stack.stackTagCompound.setInteger("playercount", 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@ package com.hbm.items.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import com.hbm.blocks.bomb.TurretBase;
|
||||
import com.hbm.tileentity.bomb.TileEntityTurretBase;
|
||||
|
||||
@ -12,29 +14,26 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import scala.actors.threadpool.Arrays;
|
||||
|
||||
public class ItemTurretChip extends Item {
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool)
|
||||
{
|
||||
list.add("Channel set to " + getFreq(itemstack));
|
||||
}
|
||||
public class ItemTurretChip extends ItemTurretBiometry {
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_)
|
||||
{
|
||||
if((world.getBlock(x, y, z) instanceof TurretBase))
|
||||
{
|
||||
if(getNames(stack) == null)
|
||||
return false;
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileEntityTurretBase) {
|
||||
((TileEntityTurretBase)te).isAI = true;
|
||||
((TileEntityTurretBase)te).uuid = player.getUniqueID().toString();
|
||||
((TileEntityTurretBase)te).freq = getFreq(stack);
|
||||
((TileEntityTurretBase)te).players = Arrays.asList(getNames(stack));
|
||||
}
|
||||
if(world.isRemote)
|
||||
{
|
||||
player.addChatMessage(new ChatComponentText("Turret ownership set to: " + player.getDisplayName() + " on channel " + getFreq(stack)));
|
||||
player.addChatMessage(new ChatComponentText("Transferred turret ownership!"));
|
||||
}
|
||||
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||
|
||||
@ -44,48 +43,4 @@ public class ItemTurretChip extends Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
int i = 0;
|
||||
|
||||
if(player.isSneaking()) {
|
||||
i = (getFreq(stack) - 1);
|
||||
} else {
|
||||
i = (getFreq(stack) + 1);
|
||||
}
|
||||
|
||||
if(i == -1)
|
||||
i = 511;
|
||||
|
||||
if(i == 512)
|
||||
i = 0;
|
||||
|
||||
setFreq(stack, i);
|
||||
|
||||
if(world.isRemote)
|
||||
player.addChatMessage(new ChatComponentText("Channel set to " + i));
|
||||
|
||||
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||
|
||||
player.swingItem();
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static int getFreq(ItemStack stack) {
|
||||
if(stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
return 0;
|
||||
}
|
||||
return stack.stackTagCompound.getInteger("freq");
|
||||
}
|
||||
|
||||
private static void setFreq(ItemStack stack, int i) {
|
||||
if(stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
stack.stackTagCompound.setInteger("freq", i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.lib;
|
||||
public class RefStrings {
|
||||
public static final String MODID = "hbm";
|
||||
public static final String NAME = "Hbm's Nuclear Tech Mod";
|
||||
public static final String VERSION = "1.0.27 BETA (2875)";
|
||||
public static final String VERSION = "1.0.27 BETA (2888)";
|
||||
//HBM's Beta Naming Convention:
|
||||
//V T (X-Y-Z)
|
||||
//V -> next release version
|
||||
|
||||
@ -584,6 +584,14 @@ public class CraftingManager {
|
||||
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.titanium_filter, 1), new Object[] { "PFP", "CBC", "CBC", 'P', "plateLead", 'B', "U238", 'C', "plateTitanium", 'F', ModItems.fuse }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.detonator, 1), new Object[] { " W", "SC", "CE", 'S', "plateSteel", 'W', ModItems.wire_red_copper, 'C', ModItems.circuit_red_copper, 'E', "ingotSteel" }));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.detonator_multi, 1), new Object[] { ModItems.detonator, ModItems.circuit_targeting_tier3 });
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.detonator_laser, 1), new Object[] { "RRD", "PIC", " P", 'P', "plateSteel", 'R', Items.redstone, 'C', ModItems.circuit_targeting_tier3, 'D', "gemDiamond", 'I', "ingotSteel" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.detonator_laser, 1), new Object[] { "RRD", "PIC", " P", 'P', "plateSteel", 'R', Items.redstone, 'C', ModItems.circuit_targeting_tier3, 'D', "gemEmerald", 'I', "ingotSteel" }));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.bomb_caller, 1, 0), new Object[] { "TTT", "TRT", "TTT", 'T', Blocks.tnt, 'R', ModItems.detonator_laser });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.bomb_caller, 1, 1), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.grenade_gascan, 'R', ModItems.detonator_laser });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.bomb_caller, 1, 2), new Object[] { "TTT", "TRT", "TTT", 'T', ModItems.pellet_gas, 'R', ModItems.detonator_laser });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.bomb_caller, 1, 3), new Object[] { "TRT", 'T', ModItems.grenade_cloud, 'R', ModItems.detonator_laser });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.bomb_caller, 1, 4), new Object[] { "TRT", 'T', ModItems.gun_fatman_ammo, 'R', ModItems.detonator_laser });
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.singularity, 1), new Object[] { "ESE", "SBS", "ESE", 'E', ModItems.nugget_euphemium, 'S', ModItems.cell_anti_schrabidium, 'B', Item.getItemFromBlock(ModBlocks.block_schrabidium) });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.singularity_counter_resonant, 1), new Object[] { "CTC", "TST", "CTC", 'C', ModItems.plate_combine_steel, 'T', ModItems.ingot_magnetized_tungsten, 'S', ModItems.singularity });
|
||||
@ -1118,6 +1126,7 @@ public class CraftingManager {
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.powder_nitan_mix, 6), new Object[] { "dustNeptunium", "dustIodine", "dustThorium", "dustAstatine", "dustNeodymium", "dustCaesium" }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.powder_nitan_mix, 6), new Object[] { "dustStrontium", "dustCobalt", "dustBromine", "dustTennessine", "dustNiobium", "dustCerium" }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.powder_spark_mix, 5), new Object[] { "dustDesh", "dustEuphemium", ModItems.powder_meteorite, ModItems.powder_power, ModItems.powder_nitan_mix }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.powder_meteorite, 5), new Object[] { "dustIron", "dustCopper", "dustLithium", "dustTungsten", "dustUranium" }));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.canister_petroil, 9), new Object[] { "RRR", "RLR", "RRR", 'R', ModItems.canister_reoil, 'L', ModItems.canister_canola });
|
||||
|
||||
@ -1203,6 +1212,7 @@ public class CraftingManager {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ams_core_thingy), new Object[] { "NSN", "NGN", "G G", 'N', "nuggetGold", 'G', "ingotGold", 'S', ModItems.battery_spark_cell_10000 }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.photo_panel), new Object[] { " G ", "IPI", " C ", 'G', "paneGlass", 'I', ModItems.plate_polymer, 'P', "dustNetherQuartz", 'C', ModItems.circuit_aluminium }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_satlinker), new Object[] { "PSP", "SCS", "PSP", 'P', "plateSteel", 'S', ModItems.ingot_starmetal, 'C', ModItems.sat_chip }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_telelinker), new Object[] { "PSP", "SCS", "PSP", 'P', "plateSteel", 'S', "ingotAdvanced", 'C', ModItems.turret_biometry }));
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.sat_chip), new Object[] { "WWW", "CIC", "WWW", 'W', ModItems.wire_red_copper, 'C', ModItems.circuit_red_copper, 'I', ModItems.ingot_polymer });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.sat_mapper), new Object[] { "H", "B", 'H', ModItems.sat_head_mapper, 'B', ModItems.sat_base });
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.sat_scanner), new Object[] { "H", "B", 'H', ModItems.sat_head_scanner, 'B', ModItems.sat_base });
|
||||
|
||||
@ -280,6 +280,7 @@ import com.hbm.tileentity.machine.TileEntityMachineSchrabidiumTransmutator;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineShredder;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSiren;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTeleLinker;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTeleporter;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTransformer;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineTurbofan;
|
||||
@ -677,6 +678,7 @@ public class MainRegistry
|
||||
GameRegistry.registerTileEntity(TileEntityVent.class, "tileentity_vent");
|
||||
GameRegistry.registerTileEntity(TileEntityLandmine.class, "tileentity_landmine");
|
||||
GameRegistry.registerTileEntity(TileEntityBomber.class, "tileentity_bomber");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineTeleLinker.class, "tileentity_telemetry_linker");
|
||||
|
||||
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.hbm.tileentity.bomb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.bomb.TurretBase;
|
||||
import com.hbm.entity.missile.EntityMissileBaseAdvanced;
|
||||
import com.hbm.items.tool.ItemTurretBiometry;
|
||||
@ -26,10 +29,9 @@ public abstract class TileEntityTurretBase extends TileEntity {
|
||||
public double rotationYaw;
|
||||
public double rotationPitch;
|
||||
public boolean isAI = false;
|
||||
public String uuid = "none";
|
||||
public List<String> players = new ArrayList();
|
||||
public int use;
|
||||
public int ammo = 0;
|
||||
public int freq = 0;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
@ -43,7 +45,7 @@ public abstract class TileEntityTurretBase extends TileEntity {
|
||||
if(this instanceof TileEntityTurretSpitfire)
|
||||
radius *= 3;
|
||||
if(this instanceof TileEntityTurretCIWS)
|
||||
radius *= 100;
|
||||
radius *= 250;
|
||||
Entity target = null;
|
||||
for (int i = 0; i < iter.length; i++)
|
||||
{
|
||||
@ -106,7 +108,7 @@ public abstract class TileEntityTurretBase extends TileEntity {
|
||||
if(this instanceof TileEntityTurretCIWS && !(e instanceof EntityMissileBaseAdvanced))
|
||||
return false;
|
||||
|
||||
if(e instanceof EntityPlayer && (((EntityPlayer)e).getUniqueID().toString().equals(uuid) || playerHasFreq((EntityPlayer)e)) )
|
||||
if(e instanceof EntityPlayer && players.contains((((EntityPlayer)e).getUniqueID().toString())))
|
||||
return false;
|
||||
|
||||
Vec3 turret;
|
||||
@ -129,20 +131,6 @@ public abstract class TileEntityTurretBase extends TileEntity {
|
||||
return !Library.isObstructed(worldObj, turret.xCoord, turret.yCoord, turret.zCoord, entity.xCoord, entity.yCoord, entity.zCoord);
|
||||
}
|
||||
|
||||
private boolean playerHasFreq(EntityPlayer player) {
|
||||
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
|
||||
ItemStack stack = player.inventory.getStackInSlot(i);
|
||||
|
||||
if(stack != null && stack.getItem() instanceof ItemTurretBiometry)
|
||||
if(ItemTurretBiometry.getFreq(stack) == this.freq)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
@ -161,9 +149,13 @@ public abstract class TileEntityTurretBase extends TileEntity {
|
||||
rotationYaw = nbt.getDouble("yaw");
|
||||
rotationPitch = nbt.getDouble("pitch");
|
||||
isAI = nbt.getBoolean("AI");
|
||||
uuid = nbt.getString("player");
|
||||
ammo = nbt.getInteger("ammo");
|
||||
freq = nbt.getInteger("freq");
|
||||
|
||||
int playercount = nbt.getInteger("playercount");
|
||||
|
||||
for(int i = 0; i < playercount; i++) {
|
||||
players.add(nbt.getString("player_") + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -172,9 +164,13 @@ public abstract class TileEntityTurretBase extends TileEntity {
|
||||
nbt.setDouble("yaw", rotationYaw);
|
||||
nbt.setDouble("pitch", rotationPitch);
|
||||
nbt.setBoolean("AI", isAI);
|
||||
nbt.setString("player", uuid);
|
||||
nbt.setInteger("ammo", ammo);
|
||||
nbt.setInteger("freq", freq);
|
||||
|
||||
nbt.setInteger("playercount", players.size());
|
||||
|
||||
for(int i = 0; i < players.size(); i++) {
|
||||
nbt.setString("player_" + i, players.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
192
com/hbm/tileentity/machine/TileEntityMachineTeleLinker.java
Normal file
@ -0,0 +1,192 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.items.tool.ItemSatChip;
|
||||
import com.hbm.items.tool.ItemTurretBiometry;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityMachineTeleLinker extends TileEntity implements ISidedInventory {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
//public static final int maxFill = 64 * 3;
|
||||
|
||||
private static final int[] slots_top = new int[] {0};
|
||||
private static final int[] slots_bottom = new int[] {1};
|
||||
private static final int[] slots_side = new int[] {2};
|
||||
|
||||
private String customName;
|
||||
|
||||
public TileEntityMachineTeleLinker() {
|
||||
slots = new ItemStack[3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return slots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
slots[i] = itemStack;
|
||||
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.hasCustomInventoryName() ? this.customName : "container.teleLinker";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
{
|
||||
return false;
|
||||
}else{
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
if(slots[i].stackSize <= j)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
||||
if (slots[i].stackSize == 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if(b0 >= 0 && b0 < slots.length)
|
||||
{
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
if(slots[i] != null)
|
||||
{
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte)i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
|
||||
{
|
||||
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
|
||||
return this.isItemValidForSlot(i, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(slots[0] != null && slots[1] != null && slots[0].getItem() instanceof ItemTurretBiometry && slots[1].getItem() instanceof ItemTurretBiometry) {
|
||||
|
||||
String[] names = ItemTurretBiometry.getNames(slots[0]);
|
||||
|
||||
if(names != null)
|
||||
for(int i = 0; i < names.length; i++)
|
||||
ItemTurretBiometry.addName(slots[1], names[i]);
|
||||
}
|
||||
|
||||
if(slots[2] != null && slots[2].getItem() instanceof ItemTurretBiometry) {
|
||||
ItemTurretBiometry.clearNames(slots[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||