No more errors, the game launches, rejoice!

This commit is contained in:
aidancbrady committed 2016-05-26 03:14:44 -04:00
1 parent 79af86daae
commit ceec3e71e9
67 files changed
+951 -676

No files matched your search

@@ -1,6 +1,7 @@
package mekanism.api;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
/**
@@ -14,15 +15,15 @@ public interface IConfigurable
* Called when a player shift-right clicks this block with a Configurator.
* @param player - the player who clicked the block
* @param side - the side the block was clicked on
* @return whether or not an action was performed
* @return action that was performed
*/
public boolean onSneakRightClick(EntityPlayer player, EnumFacing side);
public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side);
/**
* Called when a player right clicks this block with a Configurator.
* @param player - the player who clicked the block
* @param side - the side the block was clicked on
* @return whether or not an action was performed
* @return action that was performed
*/
public boolean onRightClick(EntityPlayer player, EnumFacing side);
public EnumActionResult onRightClick(EntityPlayer player, EnumFacing side);
}
+68 -67
View File
@@ -213,6 +213,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
@@ -275,7 +276,7 @@ public class ClientProxy extends CommonProxy
}
@Override
public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, BlockPos pos)
public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, BlockPos pos, EnumHand hand)
{
TileEntityPersonalChest tileEntity = (TileEntityPersonalChest)entityplayer.worldObj.getTileEntity(pos);
@@ -287,11 +288,11 @@ public class ClientProxy extends CommonProxy
entityplayer.openContainer.windowId = windowId;
}
else {
ItemStack stack = entityplayer.getCurrentEquippedItem();
ItemStack stack = entityplayer.getHeldItem(hand);
if(MachineType.get(stack) == MachineType.PERSONAL_CHEST)
{
InventoryPersonalChest inventory = new InventoryPersonalChest(entityplayer);
InventoryPersonalChest inventory = new InventoryPersonalChest(entityplayer, hand);
FMLClientHandler.instance().displayGuiScreen(entityplayer, new GuiPersonalChest(entityplayer.inventory, inventory));
entityplayer.openContainer.windowId = windowId;
}
@@ -417,65 +418,7 @@ public class ClientProxy extends CommonProxy
@Override
public void registerBlockRenders()
{
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor() {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex)
{
BlockMachine machine = (BlockMachine)state.getBlock();
if(state.getValue(machine.getMachineBlock().getProperty()) == MachineType.FLUID_TANK)
{
EnumColor color = state.getValue(BlockStateMachine.tierProperty).getColor();
return (int)(color.getColor(0)*255) << 16 | (int)(color.getColor(1)*255) << 8 | (int)(color.getColor(2)*255);
}
return -1;
}
}, MekanismBlocks.MachineBlock, MekanismBlocks.MachineBlock2, MekanismBlocks.MachineBlock3);
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor() {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex)
{
EnumDyeColor color = state.getValue(colorProperty);
EnumColor dye = EnumColor.DYES[color.getDyeDamage()];
return (int)(dye.getColor(0)*255) << 16 | (int)(dye.getColor(1)*255) << 8 | (int)(dye.getColor(2)*255);
}
}, MekanismBlocks.PlasticBlock, MekanismBlocks.GlowPlasticBlock, MekanismBlocks.RoadPlasticBlock, MekanismBlocks.ReinforcedPlasticBlock,
MekanismBlocks.SlickPlasticBlock, MekanismBlocks.PlasticFence);
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor() {
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex)
{
if(MachineType.get(stack) == MachineType.FLUID_TANK)
{
EnumColor color = ((ItemBlockMachine)stack.getItem()).getBaseTier(stack).getColor();
return (int)(color.getColor(0)*255) << 16 | (int)(color.getColor(1)*255) << 8 | (int)(color.getColor(2)*255);
}
return -1;
}
}, MekanismBlocks.MachineBlock, MekanismBlocks.MachineBlock2, MekanismBlocks.MachineBlock3);
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor() {
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex)
{
if(stack.getItem() instanceof ItemBlockPlastic)
{
EnumDyeColor dyeColor = EnumDyeColor.byMetadata(stack.getItemDamage()&15);
EnumColor dye = EnumColor.DYES[dyeColor.getDyeDamage()];
return (int)(dye.getColor(0)*255) << 16 | (int)(dye.getColor(1)*255) << 8 | (int)(dye.getColor(2)*255);
}
return -1;
}
}, MekanismBlocks.PlasticBlock, MekanismBlocks.GlowPlasticBlock, MekanismBlocks.RoadPlasticBlock, MekanismBlocks.ReinforcedPlasticBlock,
MekanismBlocks.SlickPlasticBlock, MekanismBlocks.PlasticFence);
{
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.ObsidianTNT), 0, new ModelResourceLocation("mekanism:ObsidianTNT", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.SaltBlock), 0, new ModelResourceLocation("mekanism:SaltBlock", "inventory"));
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(MekanismBlocks.CardboardBox), 0, new ModelResourceLocation("mekanism:CardboardBox", "storage=false"));
@@ -750,11 +693,11 @@ public class ClientProxy extends CommonProxy
case 13:
return new GuiTeleporter(player.inventory, (TileEntityTeleporter)tileEntity);
case 14:
ItemStack itemStack = player.getCurrentEquippedItem();
ItemStack itemStack = player.getHeldItem(EnumHand.values()[pos.getX()]);
if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter)
{
return new GuiTeleporter(player, itemStack);
return new GuiTeleporter(player, EnumHand.values()[pos.getX()], itemStack);
}
case 15:
return new GuiPurificationChamber(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
@@ -809,7 +752,7 @@ public class ClientProxy extends CommonProxy
case 37:
return new GuiChemicalCrystallizer(player.inventory, (TileEntityChemicalCrystallizer)tileEntity);
case 38:
ItemStack itemStack1 = player.getCurrentEquippedItem();
ItemStack itemStack1 = player.getHeldItem(EnumHand.values()[pos.getX()]);
if(itemStack1 != null && itemStack1.getItem() instanceof ItemSeismicReader)
{
@@ -906,9 +849,67 @@ public class ClientProxy extends CommonProxy
}
@Override
public void loadUtilities()
public void init()
{
super.loadUtilities();
super.init();
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor() {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex)
{
BlockMachine machine = (BlockMachine)state.getBlock();
if(state.getValue(machine.getMachineBlock().getProperty()) == MachineType.FLUID_TANK)
{
EnumColor color = state.getValue(BlockStateMachine.tierProperty).getColor();
return (int)(color.getColor(0)*255) << 16 | (int)(color.getColor(1)*255) << 8 | (int)(color.getColor(2)*255);
}
return -1;
}
}, MekanismBlocks.MachineBlock, MekanismBlocks.MachineBlock2, MekanismBlocks.MachineBlock3);
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor() {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex)
{
EnumDyeColor color = state.getValue(colorProperty);
EnumColor dye = EnumColor.DYES[color.getDyeDamage()];
return (int)(dye.getColor(0)*255) << 16 | (int)(dye.getColor(1)*255) << 8 | (int)(dye.getColor(2)*255);
}
}, MekanismBlocks.PlasticBlock, MekanismBlocks.GlowPlasticBlock, MekanismBlocks.RoadPlasticBlock, MekanismBlocks.ReinforcedPlasticBlock,
MekanismBlocks.SlickPlasticBlock, MekanismBlocks.PlasticFence);
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor() {
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex)
{
if(MachineType.get(stack) == MachineType.FLUID_TANK)
{
EnumColor color = ((ItemBlockMachine)stack.getItem()).getBaseTier(stack).getColor();
return (int)(color.getColor(0)*255) << 16 | (int)(color.getColor(1)*255) << 8 | (int)(color.getColor(2)*255);
}
return -1;
}
}, MekanismBlocks.MachineBlock, MekanismBlocks.MachineBlock2, MekanismBlocks.MachineBlock3);
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(new IItemColor() {
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex)
{
if(stack.getItem() instanceof ItemBlockPlastic)
{
EnumDyeColor dyeColor = EnumDyeColor.byMetadata(stack.getItemDamage()&15);
EnumColor dye = EnumColor.DYES[dyeColor.getDyeDamage()];
return (int)(dye.getColor(0)*255) << 16 | (int)(dye.getColor(1)*255) << 8 | (int)(dye.getColor(2)*255);
}
return -1;
}
}, MekanismBlocks.PlasticBlock, MekanismBlocks.GlowPlasticBlock, MekanismBlocks.RoadPlasticBlock, MekanismBlocks.ReinforcedPlasticBlock,
MekanismBlocks.SlickPlasticBlock, MekanismBlocks.PlasticFence);
MinecraftForge.EVENT_BUS.register(new ClientConnectionHandler());
MinecraftForge.EVENT_BUS.register(new ClientPlayerTracker());
@@ -224,7 +224,7 @@ public class ClientTickHandler
Mekanism.flamethrowerActive.remove(mc.thePlayer.getName());
}
Mekanism.packetHandler.sendToServer(new FlamethrowerDataMessage(PacketFlamethrowerData.FlamethrowerPacket.UPDATE, mc.thePlayer.getName(), isFlamethrowerOn(mc.thePlayer)));
Mekanism.packetHandler.sendToServer(new FlamethrowerDataMessage(PacketFlamethrowerData.FlamethrowerPacket.UPDATE, null, mc.thePlayer.getName(), isFlamethrowerOn(mc.thePlayer)));
}
if(Mekanism.jetpackOn.contains(mc.thePlayer.getName()) != isJetpackOn(mc.thePlayer))
@@ -309,11 +309,11 @@ public class ClientTickHandler
if(isFlamethrowerOn(mc.thePlayer))
{
ItemFlamethrower flamethrower = (ItemFlamethrower)mc.thePlayer.getCurrentEquippedItem().getItem();
ItemFlamethrower flamethrower = (ItemFlamethrower)mc.thePlayer.inventory.getCurrentItem().getItem();
if(!mc.thePlayer.capabilities.isCreativeMode)
{
flamethrower.useGas(mc.thePlayer.getCurrentEquippedItem());
flamethrower.useGas(mc.thePlayer.inventory.getCurrentItem());
}
}
@@ -508,11 +508,11 @@ public class ClientTickHandler
public static boolean hasFlamethrower(EntityPlayer player)
{
if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemFlamethrower)
if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower)
{
ItemFlamethrower flamethrower = (ItemFlamethrower)player.getCurrentEquippedItem().getItem();
ItemFlamethrower flamethrower = (ItemFlamethrower)player.inventory.getCurrentItem().getItem();
if(flamethrower.getGas(player.getCurrentEquippedItem()) != null)
if(flamethrower.getGas(player.inventory.getCurrentItem()) != null)
{
return true;
}
@@ -31,6 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.FMLClientHandler;
@@ -75,7 +76,7 @@ public class MekanismKeyHandler extends MekKeyHandler
if(kb == modeSwitchKey)
{
EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
ItemStack toolStack = player.getCurrentEquippedItem();
ItemStack toolStack = player.inventory.getCurrentItem();
Item item = StackUtils.getItem(toolStack);
@@ -85,7 +86,7 @@ public class MekanismKeyHandler extends MekKeyHandler
int toSet = configurator.getState(toolStack).ordinal() < ConfiguratorMode.values().length-1 ? configurator.getState(toolStack).ordinal() + 1 : 0;
configurator.setState(toolStack, ConfiguratorMode.values()[toSet]);
Mekanism.packetHandler.sendToServer(new ConfiguratorStateMessage(configurator.getState(toolStack)));
Mekanism.packetHandler.sendToServer(new ConfiguratorStateMessage(EnumHand.MAIN_HAND, configurator.getState(toolStack)));
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configureState") + ": " + configurator.getColor(configurator.getState(toolStack)) + configurator.getStateDisplay(configurator.getState(toolStack))));
}
else if(player.isSneaking() && item instanceof ItemElectricBow)
@@ -93,7 +94,7 @@ public class MekanismKeyHandler extends MekKeyHandler
ItemElectricBow bow = (ItemElectricBow)item;
bow.setFireState(toolStack, !bow.getFireState(toolStack));
Mekanism.packetHandler.sendToServer(new ElectricBowStateMessage(bow.getFireState(toolStack)));
Mekanism.packetHandler.sendToServer(new ElectricBowStateMessage(EnumHand.MAIN_HAND, bow.getFireState(toolStack)));
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.fireMode") + ": " + (bow.getFireState(toolStack) ? EnumColor.DARK_GREEN : EnumColor.DARK_RED) + LangUtils.transOnOff(bow.getFireState(toolStack))));
}
else if(player.isSneaking() && item instanceof ItemBlockMachine)
@@ -103,7 +104,7 @@ public class MekanismKeyHandler extends MekKeyHandler
if(BlockStateMachine.MachineType.get(toolStack) == BlockStateMachine.MachineType.FLUID_TANK)
{
machine.setBucketMode(toolStack, !machine.getBucketMode(toolStack));
Mekanism.packetHandler.sendToServer(new PortableTankStateMessage(machine.getBucketMode(toolStack)));
Mekanism.packetHandler.sendToServer(new PortableTankStateMessage(EnumHand.MAIN_HAND, machine.getBucketMode(toolStack)));
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.portableTank.bucketMode") + ": " + (machine.getBucketMode(toolStack) ? EnumColor.DARK_GREEN : EnumColor.DARK_RED) + LangUtils.transOnOff(machine.getBucketMode(toolStack))));
}
}
@@ -115,7 +116,7 @@ public class MekanismKeyHandler extends MekKeyHandler
{
int newChan = wt.getChannel(toolStack) < 9 ? wt.getChannel(toolStack) + 1 : 1;
wt.setChannel(toolStack, newChan);
Mekanism.packetHandler.sendToServer(new WalkieTalkieStateMessage(newChan));
Mekanism.packetHandler.sendToServer(new WalkieTalkieStateMessage(EnumHand.MAIN_HAND, newChan));
SoundHandler.playSound(MekanismSounds.DING);
}
}
@@ -124,7 +125,7 @@ public class MekanismKeyHandler extends MekKeyHandler
ItemFlamethrower flamethrower = (ItemFlamethrower)item;
flamethrower.incrementMode(toolStack);
Mekanism.packetHandler.sendToServer(new PacketFlamethrowerData.FlamethrowerDataMessage(PacketFlamethrowerData.FlamethrowerPacket.MODE, null, false));
Mekanism.packetHandler.sendToServer(new PacketFlamethrowerData.FlamethrowerDataMessage(PacketFlamethrowerData.FlamethrowerPacket.MODE, EnumHand.MAIN_HAND, null, false));
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.flamethrower.modeBump") + ": " + flamethrower.getMode(toolStack).getName()));
}
}
@@ -1,13 +1,13 @@
package mekanism.client.gui;
import mekanism.client.gui.element.GuiSecurityTab;
import mekanism.common.inventory.InventoryPersonalChest;
import mekanism.common.inventory.container.ContainerPersonalChest;
import mekanism.common.tile.TileEntityPersonalChest;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -29,14 +29,14 @@ public class GuiPersonalChest extends GuiMekanism
guiElements.add(new GuiSecurityTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPersonalChest.png")));
}
public GuiPersonalChest(InventoryPlayer inventory, IInventory inv)
public GuiPersonalChest(InventoryPlayer inventory, InventoryPersonalChest inv)
{
super(new ContainerPersonalChest(inventory, null, inv, false));
xSize+=26;
ySize+=64;
guiElements.add(new GuiSecurityTab(this, MekanismUtils.getResource(ResourceType.GUI, "GuiPersonalChest.png")));
guiElements.add(new GuiSecurityTab(this, MekanismUtils.getResource(ResourceType.GUI, "GuiPersonalChest.png"), inv.currentHand));
}
@Override
@@ -13,8 +13,6 @@ import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.frequency.Frequency;
import mekanism.common.inventory.container.ContainerQuantumEntangloporter;
import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterMessage;
import mekanism.common.network.PacketPortableTeleporter.PortableTeleporterPacketType;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityQuantumEntangloporter;
import mekanism.common.util.LangUtils;
@@ -271,19 +269,12 @@ public class GuiQuantumEntangloporter extends GuiMekanism
{
Frequency freq = privateMode ? tileEntity.privateCache.get(selection) : tileEntity.publicCache.get(selection);
if(tileEntity != null)
{
ArrayList data = new ArrayList();
data.add(1);
data.add(freq.name);
data.add(freq.publicFreq);
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
else {
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DEL_FREQ, freq));
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, null));
}
ArrayList data = new ArrayList();
data.add(1);
data.add(freq.name);
data.add(freq.publicFreq);
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
scrollList.selected = -1;
}
@@ -33,6 +33,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -45,6 +46,8 @@ public class GuiTeleporter extends GuiMekanism
{
public static int MAX_LENGTH = 16;
public EnumHand currentHand;
public ResourceLocation resource;
public TileEntityTeleporter tileEntity;
@@ -105,9 +108,10 @@ public class GuiTeleporter extends GuiMekanism
ySize+=64;
}
public GuiTeleporter(EntityPlayer player, ItemStack stack)
public GuiTeleporter(EntityPlayer player, EnumHand hand, ItemStack stack)
{
super(new ContainerNull());
currentHand = hand;
itemStack = stack;
entityPlayer = player;
resource = MekanismUtils.getResource(ResourceType.GUI, "GuiPortableTeleporter.png");
@@ -135,7 +139,7 @@ public class GuiTeleporter extends GuiMekanism
setFrequency(item.getFrequency(stack));
}
else {
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, clientFreq));
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, currentHand, clientFreq));
}
ySize = 175;
@@ -179,7 +183,7 @@ public class GuiTeleporter extends GuiMekanism
if(!isInit)
{
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, clientFreq));
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, currentHand, clientFreq));
}
else {
isInit = false;
@@ -206,7 +210,7 @@ public class GuiTeleporter extends GuiMekanism
else {
Frequency newFreq = new Frequency(freq, null).setPublic(!privateMode);
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.SET_FREQ, newFreq));
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.SET_FREQ, currentHand, newFreq));
}
}
@@ -386,8 +390,8 @@ public class GuiTeleporter extends GuiMekanism
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
else {
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DEL_FREQ, freq));
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, null));
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DEL_FREQ, currentHand, freq));
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.DATA_REQUEST, currentHand, null));
}
scrollList.selected = -1;
@@ -398,7 +402,7 @@ public class GuiTeleporter extends GuiMekanism
if(clientFreq != null && clientStatus == 1)
{
mc.setIngameFocus();
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.TELEPORT, clientFreq));
Mekanism.packetHandler.sendToServer(new PortableTeleporterMessage(PortableTeleporterPacketType.TELEPORT, currentHand, clientFreq));
}
}
@@ -20,6 +20,7 @@ import mekanism.common.util.SecurityUtils;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -28,6 +29,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class GuiSecurityTab extends GuiElement
{
public boolean isItem;
public EnumHand currentHand;
public TileEntity tileEntity;
@@ -38,11 +40,12 @@ public class GuiSecurityTab extends GuiElement
tileEntity = tile;
}
public GuiSecurityTab(IGuiWrapper gui, ResourceLocation def)
public GuiSecurityTab(IGuiWrapper gui, ResourceLocation def, EnumHand hand)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiSecurityTab.png"), gui, def);
isItem = true;
currentHand = hand;
}
@Override
@@ -163,7 +166,7 @@ public class GuiSecurityTab extends GuiElement
private ItemStack getItem()
{
return mc.thePlayer.getCurrentEquippedItem();
return mc.thePlayer.getHeldItem(currentHand);
}
@Override
@@ -185,7 +188,7 @@ public class GuiSecurityTab extends GuiElement
if(isItem)
{
Mekanism.packetHandler.sendToServer(new SecurityModeMessage(SecurityMode.values()[ordinalToSet]));
Mekanism.packetHandler.sendToServer(new SecurityModeMessage(currentHand, SecurityMode.values()[ordinalToSet]));
}
else {
Mekanism.packetHandler.sendToServer(new SecurityModeMessage(Coord4D.get(tileEntity), SecurityMode.values()[ordinalToSet]));
@@ -296,38 +296,34 @@ public class MekanismRenderer
}
}
public static BakedQuad iconTransform(BakedQuad quad, TextureAtlasSprite sprite) //TODO
public static BakedQuad iconTransform(BakedQuad quad, TextureAtlasSprite sprite)
{
int[] vertices = new int[28];
System.arraycopy(quad.getVertexData(), 0, vertices, 0, vertices.length);
vertices[4] = Float.floatToRawIntBits(sprite.getInterpolatedU(16));
vertices[5] = Float.floatToRawIntBits(sprite.getInterpolatedV(16));
vertices[7+4] = Float.floatToRawIntBits(sprite.getInterpolatedU(16));
vertices[7+5] = Float.floatToRawIntBits(sprite.getInterpolatedV(0));
vertices[14+4] = Float.floatToRawIntBits(sprite.getInterpolatedU(0));
vertices[14+5] = Float.floatToRawIntBits(sprite.getInterpolatedV(0));
vertices[21+4] = Float.floatToRawIntBits(sprite.getInterpolatedU(0));
vertices[21+5] = Float.floatToRawIntBits(sprite.getInterpolatedV(16));
for(int i = 0; i < 4; ++i)
{
int j = quad.getFormat().getIntegerSize() * i;
int uvIndex = quad.getFormat().getUvOffsetById(0) / 4;
vertices[j + uvIndex] = Float.floatToRawIntBits(sprite.getInterpolatedU(sprite.getUnInterpolatedU(Float.intBitsToFloat(vertices[j + uvIndex]))));
vertices[j + uvIndex + 1] = Float.floatToRawIntBits(sprite.getInterpolatedV(sprite.getUnInterpolatedV(Float.intBitsToFloat(vertices[j + uvIndex + 1]))));
}
return new BakedQuad(vertices, quad.getTintIndex(), quad.getFace(), sprite, quad.shouldApplyDiffuseLighting(), quad.getFormat());
}
public static BakedQuad rotate(BakedQuad quad, int amount) //TODO
public static BakedQuad rotate(BakedQuad quad, int amount)
{
int[] vertices = new int[28];
System.arraycopy(quad.getVertexData(), 0, vertices, 0, vertices.length);
int[][] uvs = new int[4][2];
for(int i = 0; i < 4; i++)
{
int nextIndex = (i+amount)%4;
vertices[7*i + 4] = quad.getVertexData()[7*nextIndex + 4];
vertices[7*i + 5] = quad.getVertexData()[7*nextIndex + 5];
int j = quad.getFormat().getIntegerSize() * i;
int uvIndex = quad.getFormat().getUvOffsetById(0) / 4;
vertices[j + uvIndex] = quad.getVertexData()[7*nextIndex + uvIndex];
vertices[j + uvIndex + 1] = quad.getVertexData()[7*nextIndex + uvIndex];
}
return new BakedQuad(vertices, quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat());
@@ -179,9 +179,9 @@ public class RenderTickHandler
{
for(EntityPlayer p : world.playerEntities)
{
if(!Mekanism.flamethrowerActive.contains(p.getName()) && !p.isSwingInProgress && p.getCurrentEquippedItem() != null && p.getCurrentEquippedItem().getItem() instanceof ItemFlamethrower)
if(!Mekanism.flamethrowerActive.contains(p.getName()) && !p.isSwingInProgress && p.inventory.getCurrentItem() != null && p.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower)
{
if(((ItemFlamethrower)p.getCurrentEquippedItem().getItem()).getGas(p.getCurrentEquippedItem()) != null)
if(((ItemFlamethrower)p.inventory.getCurrentItem().getItem()).getGas(p.inventory.getCurrentItem()) != null)
{
Pos3D playerPos = new Pos3D(p);
Pos3D flameVec;
@@ -134,17 +134,22 @@ public class GlowPanelModel extends OBJBakedModelBase
return ImmutableList.of();
}
int hash = PartGlowPanel.hash((IExtendedBlockState)state);
EnumColor color = ((IExtendedBlockState)state).getValue(ColorProperty.INSTANCE).color;
if(!glowPanelCache.containsKey(hash))
{
GlowPanelModel model = new GlowPanelModel(baseModel, getModel(), getState(), vertexFormat, textureMap, transformationMap);
model.tempState = state;
glowPanelCache.put(hash, model.getQuads(state, side, rand));
}
return glowPanelCache.get(hash);
if(state != null && tempState == null)
{
int hash = PartGlowPanel.hash((IExtendedBlockState)state);
EnumColor color = ((IExtendedBlockState)state).getValue(ColorProperty.INSTANCE).color;
if(!glowPanelCache.containsKey(hash))
{
GlowPanelModel model = new GlowPanelModel(baseModel, getModel(), getState(), vertexFormat, textureMap, transformationMap);
model.tempState = state;
glowPanelCache.put(hash, model.getQuads(state, side, rand));
}
return glowPanelCache.get(hash);
}
return super.getQuads(state, side, rand);
}
@Override
@@ -102,38 +102,43 @@ public class TransmitterModel extends OBJBakedModelBase
return ImmutableList.of();
}
IExtendedBlockState extended = (IExtendedBlockState)state;
BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer();
ColorProperty colorProp = extended.getValue(ColorProperty.INSTANCE);
int color = -1;
if(colorProp != null && colorProp.color != null)
{
color = extended.getValue(ColorProperty.INSTANCE).color.ordinal();
}
OBJState obj = extended.getValue(OBJProperty.INSTANCE);
if(layer != BlockRenderLayer.TRANSLUCENT)
{
color = -1;
}
int hash = Objects.hash(layer.ordinal(), color, obj.hashCode());
if(obj.getVisibilityMap().containsKey(Group.ALL) || obj.getVisibilityMap().containsKey(Group.ALL_EXCEPT))
{
updateStateVisibilityMap(obj);
}
if(!modelCache.containsKey(hash))
{
TransmitterModel model = new TransmitterModel(baseModel, getModel(), obj, vertexFormat, textureMap, transformationMap);
model.tempState = state;
modelCache.put(hash, model.getQuads(state, side, rand));
}
return modelCache.get(hash);
if(state != null && tempState == null)
{
IExtendedBlockState extended = (IExtendedBlockState)state;
BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer();
ColorProperty colorProp = extended.getValue(ColorProperty.INSTANCE);
int color = -1;
if(colorProp != null && colorProp.color != null)
{
color = extended.getValue(ColorProperty.INSTANCE).color.ordinal();
}
OBJState obj = extended.getValue(OBJProperty.INSTANCE);
if(layer != BlockRenderLayer.TRANSLUCENT)
{
color = -1;
}
int hash = Objects.hash(layer.ordinal(), color, obj.hashCode());
if(obj.getVisibilityMap().containsKey(Group.ALL) || obj.getVisibilityMap().containsKey(Group.ALL_EXCEPT))
{
updateStateVisibilityMap(obj);
}
if(!modelCache.containsKey(hash))
{
TransmitterModel model = new TransmitterModel(baseModel, getModel(), obj, vertexFormat, textureMap, transformationMap);
model.tempState = state;
modelCache.put(hash, model.getQuads(state, side, rand));
}
return modelCache.get(hash);
}
return super.getQuads(state, side, rand);
}
@Override
@@ -45,7 +45,7 @@ public class RenderConfigurableMachine<S extends TileEntity & ISideConfiguration
GlStateManager.pushMatrix();
EntityPlayer player = mc.thePlayer;
ItemStack itemStack = player.getCurrentEquippedItem();
ItemStack itemStack = player.inventory.getCurrentItem();
RayTraceResult pos = player.rayTrace(8.0D, 1.0F);
if(pos != null && itemStack != null && itemStack.getItem() instanceof ItemConfigurator && ((ItemConfigurator)itemStack.getItem()).getState(itemStack).isConfigurating())
@@ -94,7 +94,7 @@ public class RenderLogisticalTransporter extends RenderTransmitterBase<PartLogis
{
EntityPlayer player = mc.thePlayer;
World world = mc.thePlayer.worldObj;
ItemStack itemStack = player.getCurrentEquippedItem();
ItemStack itemStack = player.inventory.getCurrentItem();
RayTraceResult pos = player.rayTrace(8.0D, 1.0F);
if(pos != null && itemStack != null && itemStack.getItem() instanceof ItemConfigurator)
@@ -21,7 +21,7 @@ public class FlamethrowerSound extends PlayerSound
onSound = new ResourceLocation("mekanism", "item.flamethrower.active");
offSound = new ResourceLocation("mekanism", "item.flamethrower.idle");
inUse = ClientTickHandler.isFlamethrowerOn(player);
sound = inUse ? onSound : offSound;
soundLocation = inUse ? onSound : offSound;
setFadeIn(0);
setFadeOut(0);
@@ -57,7 +57,7 @@ public class FlamethrowerSound extends PlayerSound
if(inUse != ClientTickHandler.isFlamethrowerOn(player))
{
inUse = ClientTickHandler.isFlamethrowerOn(player);
sound = inUse ? onSound : offSound;
soundLocation = inUse ? onSound : offSound;
donePlaying = true;
}
}
@@ -2,7 +2,11 @@ package mekanism.client.sound;
import mekanism.api.MekanismConfig.client;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.Sound;
import net.minecraft.client.audio.SoundEventAccessor;
import net.minecraft.client.audio.SoundHandler;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -19,9 +23,13 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class MekSound implements ISound
{
protected Sound sound;
protected SoundEventAccessor soundEvent;
protected AttenuationType attenuation;
protected ResourceLocation sound;
protected ResourceLocation soundLocation;
protected float volume;
@@ -105,7 +113,7 @@ public class MekSound implements ISound
public MekSound(ResourceLocation resource, float v, float p, boolean rep, int delay, double xPos, double yPos, double zPos, AttenuationType att)
{
attenuation = att;
sound = resource;
soundLocation = resource;
volume = v;
pitch = p;
x = (float)xPos;
@@ -118,7 +126,7 @@ public class MekSound implements ISound
public MekSound(MekSound other)
{
attenuation = other.attenuation;
sound = other.sound;
soundLocation = other.soundLocation;
volume = other.volume;
pitch = other.pitch;
x = other.x;
@@ -137,7 +145,7 @@ public class MekSound implements ISound
@Override
public ResourceLocation getSoundLocation()
{
return sound;
return soundLocation;
}
@Override
@@ -181,4 +189,32 @@ public class MekSound implements ISound
{
return repeatDelay;
}
@Override
public SoundEventAccessor createAccessor(SoundHandler handler)
{
soundEvent = handler.getAccessor(soundLocation);
if(soundEvent == null)
{
sound = SoundHandler.MISSING_SOUND;
}
else {
sound = soundEvent.cloneEntry();
}
return soundEvent;
}
@Override
public Sound getSound()
{
return sound;
}
@Override
public SoundCategory getCategory()
{
return SoundCategory.BLOCKS;
}
}
@@ -52,7 +52,7 @@ public class TileSound extends MekSound implements IResettableSound
super(resource, volume, pitch, repeat, repeatDelay, x, y, z, attenuation);
source = soundSource;
sound = resource;
soundLocation = resource;
baseVolume = volume;
}
@@ -57,7 +57,7 @@ public class CommonPlayerTickHandler
if(!player.capabilities.isCreativeMode)
{
((ItemFlamethrower)player.getCurrentEquippedItem().getItem()).useGas(player.getCurrentEquippedItem());
((ItemFlamethrower)player.inventory.getCurrentItem().getItem()).useGas(player.inventory.getCurrentItem());
}
}
@@ -220,7 +220,7 @@ public class CommonPlayerTickHandler
{
if(Mekanism.flamethrowerActive.contains(player.getName()))
{
if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemFlamethrower)
if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof ItemFlamethrower)
{
return true;
}
@@ -122,6 +122,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
@@ -196,7 +197,7 @@ public class CommonProxy implements IGuiProvider
* @param isBlock - if the chest is a block
* @param pos - coordinates
*/
public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, BlockPos pos) {}
public void openPersonalChest(EntityPlayer entityplayer, int id, int windowId, boolean isBlock, BlockPos pos, EnumHand hand) {}
/**
* Register and load client-only item render information.
@@ -361,7 +362,7 @@ public class CommonProxy implements IGuiProvider
/**
* Set up and load the utilities this mod uses.
*/
public void loadUtilities()
public void init()
{
MinecraftForge.EVENT_BUS.register(Mekanism.worldTickHandler);
}
@@ -429,7 +430,7 @@ public class CommonProxy implements IGuiProvider
case 13:
return new ContainerTeleporter(player.inventory, (TileEntityTeleporter)tileEntity);
case 14:
ItemStack itemStack = player.getCurrentEquippedItem();
ItemStack itemStack = player.getHeldItem(EnumHand.values()[pos.getX()]);
if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter)
{
+1 -1
View File
@@ -1403,7 +1403,7 @@ public class Mekanism
packetHandler.initialize();
//Load proxy
proxy.loadUtilities();
proxy.init();
//Completion notification
logger.info("Loading complete.");
@@ -23,8 +23,15 @@ import mekanism.common.block.states.BlockStateMachine.MachineBlockStateMapper;
import mekanism.common.block.states.BlockStatePlastic.PlasticBlockStateMapper;
import mekanism.common.block.states.BlockStatePlastic.PlasticBlockType;
import mekanism.common.item.ItemBlockBasic;
import mekanism.common.item.ItemBlockCardboardBox;
import mekanism.common.item.ItemBlockEnergyCube;
import mekanism.common.item.ItemBlockGasTank;
import mekanism.common.item.ItemBlockMachine;
import mekanism.common.item.ItemBlockOre;
import mekanism.common.item.ItemBlockPlastic;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
@@ -32,24 +39,24 @@ import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
@ObjectHolder("Mekanism")
public class MekanismBlocks
{
public static final Block BasicBlock = BlockBasic.getBlockBasic(BASIC_BLOCK_1).setUnlocalizedName("BasicBlock");
public static final Block BasicBlock2 = BlockBasic.getBlockBasic(BASIC_BLOCK_2).setUnlocalizedName("BasicBlock2");
public static final Block MachineBlock = BlockMachine.getBlockMachine(MACHINE_BLOCK_1).setUnlocalizedName("MachineBlock");
public static final Block MachineBlock2 = BlockMachine.getBlockMachine(MACHINE_BLOCK_2).setUnlocalizedName("MachineBlock2");
public static final Block MachineBlock3 = BlockMachine.getBlockMachine(MACHINE_BLOCK_3).setUnlocalizedName("MachineBlock3");
public static final Block OreBlock = new BlockOre().setUnlocalizedName("OreBlock");
public static final Block ObsidianTNT = new BlockObsidianTNT().setUnlocalizedName("ObsidianTNT").setCreativeTab(Mekanism.tabMekanism);
public static final Block EnergyCube = new BlockEnergyCube().setUnlocalizedName("EnergyCube");
public static final Block BoundingBlock = (BlockBounding)new BlockBounding().setUnlocalizedName("BoundingBlock");
public static final Block GasTank = new BlockGasTank().setUnlocalizedName("GasTank");
public static final Block CardboardBox = new BlockCardboardBox().setUnlocalizedName("CardboardBox");
public static final Block PlasticBlock = new BlockPlastic(PlasticBlockType.PLASTIC).setUnlocalizedName("PlasticBlock");
public static final Block SlickPlasticBlock = new BlockPlastic(PlasticBlockType.SLICK).setUnlocalizedName("SlickPlasticBlock");
public static final Block GlowPlasticBlock = new BlockPlastic(PlasticBlockType.GLOW).setUnlocalizedName("GlowPlasticBlock");
public static final Block ReinforcedPlasticBlock = new BlockPlastic(PlasticBlockType.REINFORCED).setUnlocalizedName("ReinforcedPlasticBlock");
public static final Block RoadPlasticBlock = new BlockPlastic(PlasticBlockType.ROAD).setUnlocalizedName("RoadPlasticBlock");
public static final Block PlasticFence = new BlockPlasticFence().setUnlocalizedName("PlasticFence");
public static final Block SaltBlock = new BlockSalt().setUnlocalizedName("SaltBlock");
public static final Block BasicBlock = init(BlockBasic.getBlockBasic(BASIC_BLOCK_1), "BasicBlock");
public static final Block BasicBlock2 = init(BlockBasic.getBlockBasic(BASIC_BLOCK_2), "BasicBlock2");
public static final Block MachineBlock = init(BlockMachine.getBlockMachine(MACHINE_BLOCK_1), "MachineBlock");
public static final Block MachineBlock2 = init(BlockMachine.getBlockMachine(MACHINE_BLOCK_2), "MachineBlock2");
public static final Block MachineBlock3 = init(BlockMachine.getBlockMachine(MACHINE_BLOCK_3), "MachineBlock3");
public static final Block OreBlock = init(new BlockOre(), "OreBlock");
public static final Block ObsidianTNT = init(new BlockObsidianTNT(), "ObsidianTNT").setCreativeTab(Mekanism.tabMekanism);
public static final Block EnergyCube = init(new BlockEnergyCube(), "EnergyCube");
public static final Block BoundingBlock = (BlockBounding)init(new BlockBounding(), "BoundingBlock");
public static final Block GasTank = init(new BlockGasTank(), "GasTank");
public static final Block CardboardBox = init(new BlockCardboardBox(), "CardboardBox");
public static final Block PlasticBlock = init(new BlockPlastic(PlasticBlockType.PLASTIC), "PlasticBlock");
public static final Block SlickPlasticBlock = init(new BlockPlastic(PlasticBlockType.SLICK), "SlickPlasticBlock");
public static final Block GlowPlasticBlock = init(new BlockPlastic(PlasticBlockType.GLOW), "GlowPlasticBlock");
public static final Block ReinforcedPlasticBlock = init(new BlockPlastic(PlasticBlockType.REINFORCED), "ReinforcedPlasticBlock");
public static final Block RoadPlasticBlock = init(new BlockPlastic(PlasticBlockType.ROAD), "RoadPlasticBlock");
public static final Block PlasticFence = init(new BlockPlasticFence(), "PlasticFence");
public static final Block SaltBlock = init(new BlockSalt(), "SaltBlock");
private static final IStateMapper machineMapper = new MachineBlockStateMapper();
private static final IStateMapper basicMapper = new BasicBlockStateMapper();
@@ -81,21 +88,24 @@ public class MekanismBlocks
GameRegistry.register(PlasticFence);
GameRegistry.register(SaltBlock);
GameRegistry.register(new ItemBlockBasic(BasicBlock).setUnlocalizedName("BasicBlock"));
GameRegistry.register(new ItemBlockBasic(BasicBlock2).setUnlocalizedName("BasicBlock2"));
GameRegistry.register(new ItemBlockBasic(MachineBlock).setUnlocalizedName("MachineBlock"));
GameRegistry.register(new ItemBlockBasic(MachineBlock2).setUnlocalizedName("MachineBlock2"));
GameRegistry.register(new ItemBlockBasic(MachineBlock3).setUnlocalizedName("MachineBlock3"));
GameRegistry.register(new ItemBlockBasic(OreBlock).setUnlocalizedName("OreBlock"));
GameRegistry.register(new ItemBlockBasic(EnergyCube).setUnlocalizedName("EnergyCube"));
GameRegistry.register(new ItemBlockBasic(GasTank).setUnlocalizedName("GasTank"));
GameRegistry.register(new ItemBlockBasic(CardboardBox).setUnlocalizedName("CardboardBox"));
GameRegistry.register(new ItemBlockBasic(PlasticBlock).setUnlocalizedName("PlasticBlock"));
GameRegistry.register(new ItemBlockBasic(SlickPlasticBlock).setUnlocalizedName("SlickPlasticBlock"));
GameRegistry.register(new ItemBlockBasic(GlowPlasticBlock).setUnlocalizedName("GlowPlasticBlock"));
GameRegistry.register(new ItemBlockBasic(ReinforcedPlasticBlock).setUnlocalizedName("ReinforcedPlasticBlock"));
GameRegistry.register(new ItemBlockBasic(RoadPlasticBlock).setUnlocalizedName("RoadPlasticBlock"));
GameRegistry.register(new ItemBlockBasic(PlasticFence).setUnlocalizedName("PlasticFence"));
GameRegistry.register(MekanismItems.init(new ItemBlockBasic(BasicBlock), "BasicBlock"));
GameRegistry.register(MekanismItems.init(new ItemBlockBasic(BasicBlock2), "BasicBlock2"));
GameRegistry.register(MekanismItems.init(new ItemBlockMachine(MachineBlock), "MachineBlock"));
GameRegistry.register(MekanismItems.init(new ItemBlockMachine(MachineBlock2), "MachineBlock2"));
GameRegistry.register(MekanismItems.init(new ItemBlockMachine(MachineBlock3), "MachineBlock3"));
GameRegistry.register(MekanismItems.init(new ItemBlockOre(OreBlock), "OreBlock"));
GameRegistry.register(MekanismItems.init(new ItemBlockEnergyCube(EnergyCube), "EnergyCube"));
GameRegistry.register(MekanismItems.init(new ItemBlock(ObsidianTNT), "ObsidianTNT"));
GameRegistry.register(MekanismItems.init(new ItemBlock(BoundingBlock), "BoundingBlock"));
GameRegistry.register(MekanismItems.init(new ItemBlockGasTank(GasTank), "GasTank"));
GameRegistry.register(MekanismItems.init(new ItemBlockCardboardBox(CardboardBox), "CardboardBox"));
GameRegistry.register(MekanismItems.init(new ItemBlockPlastic(PlasticBlock), "PlasticBlock"));
GameRegistry.register(MekanismItems.init(new ItemBlockPlastic(SlickPlasticBlock), "SlickPlasticBlock"));
GameRegistry.register(MekanismItems.init(new ItemBlockPlastic(GlowPlasticBlock), "GlowPlasticBlock"));
GameRegistry.register(MekanismItems.init(new ItemBlockPlastic(ReinforcedPlasticBlock), "ReinforcedPlasticBlock"));
GameRegistry.register(MekanismItems.init(new ItemBlockPlastic(RoadPlasticBlock), "RoadPlasticBlock"));
GameRegistry.register(MekanismItems.init(new ItemBlockPlastic(PlasticFence), "PlasticFence"));
GameRegistry.register(MekanismItems.init(new ItemBlock(SaltBlock), "SaltBlock"));
ModelLoader.setCustomStateMapper(MachineBlock, machineMapper);
ModelLoader.setCustomStateMapper(MachineBlock2, machineMapper);
@@ -112,4 +122,9 @@ public class MekanismBlocks
Mekanism.proxy.registerBlockRenders();
}
public static Block init(Block block, String name)
{
return block.setUnlocalizedName(name).setRegistryName("mekanism:" + name);
}
}
+115 -110
View File
@@ -47,124 +47,124 @@ import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
@ObjectHolder("Mekanism")
public class MekanismItems
{
public static final Item EnrichedAlloy = new ItemAlloy().setUnlocalizedName("EnrichedAlloy");
public static final Item ReinforcedAlloy = new ItemAlloy().setUnlocalizedName("ReinforcedAlloy");
public static final Item AtomicAlloy = new ItemAlloy().setUnlocalizedName("AtomicAlloy");
public static final Item TeleportationCore = new ItemMekanism().setUnlocalizedName("TeleportationCore");
public static final Item ElectrolyticCore = new ItemMekanism().setUnlocalizedName("ElectrolyticCore");
public static final Item Substrate = new ItemMekanism().setUnlocalizedName("Substrate");
public static final Item Polyethene = new ItemHDPE().setUnlocalizedName("HDPE");
public static final Item BioFuel = new ItemMekanism().setUnlocalizedName("BioFuel");
public static final Item ItemProxy = new ItemProxy().setUnlocalizedName("ItemProxy");
public static final Item EnrichedIron = new ItemMekanism().setUnlocalizedName("EnrichedIron");
public static final Item CompressedCarbon = new ItemMekanism().setUnlocalizedName("CompressedCarbon");
public static final Item CompressedRedstone = new ItemMekanism().setUnlocalizedName("CompressedRedstone");
public static final Item CompressedDiamond = new ItemMekanism().setUnlocalizedName("CompressedDiamond");
public static final Item CompressedObsidian = new ItemMekanism().setUnlocalizedName("CompressedObsidian");
public static final Item BrineBucket = new ItemMekanism().setMaxStackSize(1).setContainerItem(Items.BUCKET).setUnlocalizedName("BrineBucket");
public static final Item LithiumBucket = new ItemMekanism().setMaxStackSize(1).setContainerItem(Items.BUCKET).setUnlocalizedName("LithiumBucket");
public static final Item HeavyWaterBucket = new ItemMekanism().setMaxStackSize(1).setContainerItem(Items.BUCKET).setUnlocalizedName("HeavyWaterBucket");
public static final Item SpeedUpgrade = new ItemUpgrade(Upgrade.SPEED).setUnlocalizedName("SpeedUpgrade");
public static final Item EnergyUpgrade = new ItemUpgrade(Upgrade.ENERGY).setUnlocalizedName("EnergyUpgrade");
public static final Item FilterUpgrade = new ItemUpgrade(Upgrade.FILTER).setUnlocalizedName("FilterUpgrade");
public static final Item MufflingUpgrade = new ItemUpgrade(Upgrade.MUFFLING).setUnlocalizedName("MufflingUpgrade");
public static final Item GasUpgrade = new ItemUpgrade(Upgrade.GAS).setUnlocalizedName("GasUpgrade");
public static final Item FactoryInstaller = new ItemFactoryInstaller().setUnlocalizedName("FactoryInstaller");
public static final ItemEnergized EnergyTablet = (ItemEnergized)new ItemEnergized(1000000).setUnlocalizedName("EnergyTablet");
public static final ItemRobit Robit = (ItemRobit)new ItemRobit().setUnlocalizedName("Robit");
public static final ItemAtomicDisassembler AtomicDisassembler = (ItemAtomicDisassembler)new ItemAtomicDisassembler().setUnlocalizedName("AtomicDisassembler");
public static final ItemPortableTeleporter PortableTeleporter = (ItemPortableTeleporter)new ItemPortableTeleporter().setUnlocalizedName("PortableTeleporter");
public static final ItemConfigurator Configurator = (ItemConfigurator)new ItemConfigurator().setUnlocalizedName("Configurator");
public static final ItemNetworkReader NetworkReader = (ItemNetworkReader)new ItemNetworkReader().setUnlocalizedName("NetworkReader");
public static final Item WalkieTalkie = new ItemWalkieTalkie().setUnlocalizedName("WalkieTalkie");
public static final ItemElectricBow ElectricBow = (ItemElectricBow)new ItemElectricBow().setUnlocalizedName("ElectricBow");
public static final ItemFlamethrower Flamethrower = (ItemFlamethrower)new ItemFlamethrower().setUnlocalizedName("Flamethrower");
public static final ItemSeismicReader SeismicReader = (ItemSeismicReader)new ItemSeismicReader().setUnlocalizedName("SeismicReader");
public static final Item Dictionary = new ItemDictionary().setUnlocalizedName("Dictionary");
public static final ItemGaugeDropper GaugeDropper = (ItemGaugeDropper)new ItemGaugeDropper().setUnlocalizedName("GaugeDropper");
public static final Item ConfigurationCard = new ItemConfigurationCard().setUnlocalizedName("ConfigurationCard");
public static final Item CraftingFormula = new ItemCraftingFormula().setUnlocalizedName("CraftingFormula");
public static final Item PartTransmitter = new ItemPartTransmitter().setUnlocalizedName("MultipartTransmitter");
public static final Item GlowPanel = new ItemGlowPanel().setUnlocalizedName("GlowPanel");
public static final ItemScubaTank ScubaTank = (ItemScubaTank)new ItemScubaTank().setUnlocalizedName("ScubaTank");
public static final ItemGasMask GasMask = (ItemGasMask)new ItemGasMask().setUnlocalizedName("GasMask");
public static final ItemJetpack Jetpack = (ItemJetpack)new ItemJetpack().setUnlocalizedName("Jetpack");
public static final ItemJetpack ArmoredJetpack = (ItemJetpack)new ItemJetpack().setUnlocalizedName("ArmoredJetpack");
public static final ItemFreeRunners FreeRunners = (ItemFreeRunners)new ItemFreeRunners().setUnlocalizedName("FreeRunners");
public static final Item Balloon = new ItemBalloon().setUnlocalizedName("Balloon");
public static final Item EnrichedAlloy = init(new ItemAlloy(), "EnrichedAlloy");
public static final Item ReinforcedAlloy = init(new ItemAlloy(), "ReinforcedAlloy");
public static final Item AtomicAlloy = init(new ItemAlloy(), "AtomicAlloy");
public static final Item TeleportationCore = init(new ItemMekanism(), "TeleportationCore");
public static final Item ElectrolyticCore = init(new ItemMekanism(), "ElectrolyticCore");
public static final Item Substrate = init(new ItemMekanism(), "Substrate");
public static final Item Polyethene = init(new ItemHDPE(), "HDPE");
public static final Item BioFuel = init(new ItemMekanism(), "BioFuel");
public static final Item ItemProxy = init(new ItemProxy(), "ItemProxy");
public static final Item EnrichedIron = init(new ItemMekanism(), "EnrichedIron");
public static final Item CompressedCarbon = init(new ItemMekanism(), "CompressedCarbon");
public static final Item CompressedRedstone = init(new ItemMekanism(), "CompressedRedstone");
public static final Item CompressedDiamond = init(new ItemMekanism(), "CompressedDiamond");
public static final Item CompressedObsidian = init(new ItemMekanism(), "CompressedObsidian");
public static final Item BrineBucket = init(new ItemMekanism().setMaxStackSize(1).setContainerItem(Items.BUCKET), "BrineBucket");
public static final Item LithiumBucket = init(new ItemMekanism().setMaxStackSize(1).setContainerItem(Items.BUCKET), "LithiumBucket");
public static final Item HeavyWaterBucket = init(new ItemMekanism().setMaxStackSize(1).setContainerItem(Items.BUCKET), "HeavyWaterBucket");
public static final Item SpeedUpgrade = init(new ItemUpgrade(Upgrade.SPEED), "SpeedUpgrade");
public static final Item EnergyUpgrade = init(new ItemUpgrade(Upgrade.ENERGY), "EnergyUpgrade");
public static final Item FilterUpgrade = init(new ItemUpgrade(Upgrade.FILTER), "FilterUpgrade");
public static final Item MufflingUpgrade = init(new ItemUpgrade(Upgrade.MUFFLING), "MufflingUpgrade");
public static final Item GasUpgrade = init(new ItemUpgrade(Upgrade.GAS), "GasUpgrade");
public static final Item FactoryInstaller = init(new ItemFactoryInstaller(), "FactoryInstaller");
public static final ItemEnergized EnergyTablet = (ItemEnergized)init(new ItemEnergized(1000000), "EnergyTablet");
public static final ItemRobit Robit = (ItemRobit)init(new ItemRobit(), "Robit");
public static final ItemAtomicDisassembler AtomicDisassembler = (ItemAtomicDisassembler)init(new ItemAtomicDisassembler(), "AtomicDisassembler");
public static final ItemPortableTeleporter PortableTeleporter = (ItemPortableTeleporter)init(new ItemPortableTeleporter(), "PortableTeleporter");
public static final ItemConfigurator Configurator = (ItemConfigurator)init(new ItemConfigurator(), "Configurator");
public static final ItemNetworkReader NetworkReader = (ItemNetworkReader)init(new ItemNetworkReader(), "NetworkReader");
public static final Item WalkieTalkie = init(new ItemWalkieTalkie(), "WalkieTalkie");
public static final ItemElectricBow ElectricBow = (ItemElectricBow)init(new ItemElectricBow(), "ElectricBow");
public static final ItemFlamethrower Flamethrower = (ItemFlamethrower)init(new ItemFlamethrower(), "Flamethrower");
public static final ItemSeismicReader SeismicReader = (ItemSeismicReader)init(new ItemSeismicReader(), "SeismicReader");
public static final Item Dictionary = init(new ItemDictionary(), "Dictionary");
public static final ItemGaugeDropper GaugeDropper = (ItemGaugeDropper)init(new ItemGaugeDropper(), "GaugeDropper");
public static final Item ConfigurationCard = init(new ItemConfigurationCard(), "ConfigurationCard");
public static final Item CraftingFormula = init(new ItemCraftingFormula(), "CraftingFormula");
public static final Item PartTransmitter = init(new ItemPartTransmitter(), "MultipartTransmitter");
public static final Item GlowPanel = init(new ItemGlowPanel(), "GlowPanel");
public static final ItemScubaTank ScubaTank = (ItemScubaTank)init(new ItemScubaTank(), "ScubaTank");
public static final ItemGasMask GasMask = (ItemGasMask)init(new ItemGasMask(), "GasMask");
public static final ItemJetpack Jetpack = (ItemJetpack)init(new ItemJetpack(), "Jetpack");
public static final ItemJetpack ArmoredJetpack = (ItemJetpack)init(new ItemJetpack(), "ArmoredJetpack");
public static final ItemFreeRunners FreeRunners = (ItemFreeRunners)init(new ItemFreeRunners(), "FreeRunners");
public static final Item Balloon = init(new ItemBalloon(), "Balloon");
//Multi-ID Items
public static final Item OtherDust = new ItemOtherDust();
public static final Item Dust = new ItemDust();
public static final Item Sawdust = new ItemMekanism().setUnlocalizedName("Sawdust");
public static final Item Salt = new ItemMekanism().setUnlocalizedName("Salt");
public static final Item Ingot = new ItemIngot();
public static final Item Clump = new ItemClump();
public static final Item DirtyDust = new ItemDirtyDust();
public static final Item Shard = new ItemShard();
public static final Item Crystal = new ItemCrystal();
public static final Item ControlCircuit = new ItemControlCircuit();
public static final Item OtherDust = init(new ItemOtherDust(), "OtherDust");
public static final Item Dust = init(new ItemDust(), "Dust");
public static final Item Sawdust = init(new ItemMekanism(), "Sawdust");
public static final Item Salt = init(new ItemMekanism(), "Salt");
public static final Item Ingot = init(new ItemIngot(), "Ingot");
public static final Item Clump = init(new ItemClump(), "Clump");
public static final Item DirtyDust = init(new ItemDirtyDust(), "DirtyDust");
public static final Item Shard = init(new ItemShard(), "Shard");
public static final Item Crystal = init(new ItemCrystal(), "Crystal");
public static final Item ControlCircuit = init(new ItemControlCircuit(), "ControlCircuit");
/**
* Adds and registers all items.
*/
public static void register()
{
GameRegistry.registerItem(PartTransmitter, "PartTransmitter");
GameRegistry.registerItem(ElectricBow, "ElectricBow");
GameRegistry.registerItem(Dust, "Dust");
GameRegistry.registerItem(Ingot, "Ingot");
GameRegistry.registerItem(EnergyTablet, "EnergyTablet");
GameRegistry.registerItem(SpeedUpgrade, "SpeedUpgrade");
GameRegistry.registerItem(EnergyUpgrade, "EnergyUpgrade");
GameRegistry.registerItem(FilterUpgrade, "FilterUpgrade");
GameRegistry.registerItem(MufflingUpgrade, "MufflingUpgrade");
GameRegistry.registerItem(GasUpgrade, "GasUpgrade");
GameRegistry.registerItem(Robit, "Robit");
GameRegistry.registerItem(AtomicDisassembler, "AtomicDisassembler");
GameRegistry.registerItem(EnrichedAlloy, "EnrichedAlloy");
GameRegistry.registerItem(ReinforcedAlloy, "ReinforcedAlloy");
GameRegistry.registerItem(AtomicAlloy, "AtomicAlloy");
GameRegistry.registerItem(ItemProxy, "ItemProxy");
GameRegistry.registerItem(ControlCircuit, "ControlCircuit");
GameRegistry.registerItem(EnrichedIron, "EnrichedIron");
GameRegistry.registerItem(CompressedCarbon, "CompressedCarbon");
GameRegistry.registerItem(CompressedRedstone, "CompressedRedstone");
GameRegistry.registerItem(CompressedDiamond, "CompressedDiamond");
GameRegistry.registerItem(CompressedObsidian, "CompressedObsidian");
GameRegistry.registerItem(PortableTeleporter, "PortableTeleporter");
GameRegistry.registerItem(TeleportationCore, "TeleportationCore");
GameRegistry.registerItem(Clump, "Clump");
GameRegistry.registerItem(DirtyDust, "DirtyDust");
GameRegistry.registerItem(Configurator, "Configurator");
GameRegistry.registerItem(NetworkReader, "NetworkReader");
GameRegistry.registerItem(WalkieTalkie, "WalkieTalkie");
GameRegistry.registerItem(Jetpack, "Jetpack");
GameRegistry.registerItem(Dictionary, "Dictionary");
GameRegistry.registerItem(GasMask, "GasMask");
GameRegistry.registerItem(ScubaTank, "ScubaTank");
GameRegistry.registerItem(Balloon, "Balloon");
GameRegistry.registerItem(Shard, "Shard");
GameRegistry.registerItem(ElectrolyticCore, "ElectrolyticCore");
GameRegistry.registerItem(Sawdust, "Sawdust");
GameRegistry.registerItem(Salt, "Salt");
GameRegistry.registerItem(BrineBucket, "BrineBucket");
GameRegistry.registerItem(LithiumBucket, "LithiumBucket");
GameRegistry.registerItem(HeavyWaterBucket, "HeavyWaterBucket");
GameRegistry.registerItem(Crystal, "Crystal");
GameRegistry.registerItem(FreeRunners, "FreeRunners");
GameRegistry.registerItem(ArmoredJetpack, "ArmoredJetpack");
GameRegistry.registerItem(ConfigurationCard, "ConfigurationCard");
GameRegistry.registerItem(CraftingFormula, "CraftingFormula");
GameRegistry.registerItem(SeismicReader, "SeismicReader");
GameRegistry.registerItem(Substrate, "Substrate");
GameRegistry.registerItem(Polyethene, "Polyethene");
GameRegistry.registerItem(BioFuel, "BioFuel");
GameRegistry.registerItem(GlowPanel, "GlowPanel");
GameRegistry.registerItem(Flamethrower, "Flamethrower");
GameRegistry.registerItem(GaugeDropper, "GaugeDropper");
GameRegistry.registerItem(FactoryInstaller, "FactoryInstaller");
GameRegistry.registerItem(OtherDust, "OtherDust");
GameRegistry.register(PartTransmitter);
GameRegistry.register(ElectricBow);
GameRegistry.register(Dust);
GameRegistry.register(Ingot);
GameRegistry.register(EnergyTablet);
GameRegistry.register(SpeedUpgrade);
GameRegistry.register(EnergyUpgrade);
GameRegistry.register(FilterUpgrade);
GameRegistry.register(MufflingUpgrade);
GameRegistry.register(GasUpgrade);
GameRegistry.register(Robit);
GameRegistry.register(AtomicDisassembler);
GameRegistry.register(EnrichedAlloy);
GameRegistry.register(ReinforcedAlloy);
GameRegistry.register(AtomicAlloy);
GameRegistry.register(ItemProxy);
GameRegistry.register(ControlCircuit);
GameRegistry.register(EnrichedIron);
GameRegistry.register(CompressedCarbon);
GameRegistry.register(CompressedRedstone);
GameRegistry.register(CompressedDiamond);
GameRegistry.register(CompressedObsidian);
GameRegistry.register(PortableTeleporter);
GameRegistry.register(TeleportationCore);
GameRegistry.register(Clump);
GameRegistry.register(DirtyDust);
GameRegistry.register(Configurator);
GameRegistry.register(NetworkReader);
GameRegistry.register(WalkieTalkie);
GameRegistry.register(Jetpack);
GameRegistry.register(Dictionary);
GameRegistry.register(GasMask);
GameRegistry.register(ScubaTank);
GameRegistry.register(Balloon);
GameRegistry.register(Shard);
GameRegistry.register(ElectrolyticCore);
GameRegistry.register(Sawdust);
GameRegistry.register(Salt);
GameRegistry.register(BrineBucket);
GameRegistry.register(LithiumBucket);
GameRegistry.register(HeavyWaterBucket);
GameRegistry.register(Crystal);
GameRegistry.register(FreeRunners);
GameRegistry.register(ArmoredJetpack);
GameRegistry.register(ConfigurationCard);
GameRegistry.register(CraftingFormula);
GameRegistry.register(SeismicReader);
GameRegistry.register(Substrate);
GameRegistry.register(Polyethene);
GameRegistry.register(BioFuel);
GameRegistry.register(GlowPanel);
GameRegistry.register(Flamethrower);
GameRegistry.register(GaugeDropper);
GameRegistry.register(FactoryInstaller);
GameRegistry.register(OtherDust);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid("brine"), new ItemStack(BrineBucket), FluidContainerRegistry.EMPTY_BUCKET);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid("lithium"), new ItemStack(LithiumBucket), FluidContainerRegistry.EMPTY_BUCKET);
@@ -175,4 +175,9 @@ public class MekanismItems
Mekanism.proxy.registerItemRenders();
}
public static Item init(Item item, String name)
{
return item.setUnlocalizedName(name).setRegistryName("mekanism:" + name);
}
}
@@ -938,17 +938,17 @@ public abstract class BlockBasic extends Block implements ICTMBlock
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, BlockPos pos, EnumFacing side)
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
BlockPos offsetPos = pos.offset(side.getOpposite());
if(BasicBlockType.get(world.getBlockState(offsetPos)) == BasicBlockType.STRUCTURAL_GLASS)
if(BasicBlockType.get(state) == BasicBlockType.STRUCTURAL_GLASS)
{
return ctmData[10][0].shouldRenderSide(world, pos, side);
}
else {
return super.shouldSideBeRendered(world, pos, side);
if(!ctmData[10][0].shouldRenderSide(world, pos, side))
{
return false;
}
}
return super.shouldSideBeRendered(state, world, pos, side);
}
@Override
@@ -96,7 +96,7 @@ public class BlockStateMachine extends ExtendedBlockState
{
if(machineTypeProperty == null)
{
machineTypeProperty = PropertyEnum.create("machineType", MachineType.class, new MachineBlockPredicate(this));
machineTypeProperty = PropertyEnum.create("type", MachineType.class, new MachineBlockPredicate(this));
}
return machineTypeProperty;
@@ -3,6 +3,7 @@ package mekanism.common.capabilities;
import mekanism.api.IConfigurable;
import mekanism.common.capabilities.StorageHelper.NullStorage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.CapabilityManager;
@@ -12,15 +13,15 @@ import net.minecraftforge.common.capabilities.CapabilityManager;
public class Configurable implements IConfigurable
{
@Override
public boolean onSneakRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side)
{
return false;
return EnumActionResult.PASS;
}
@Override
public boolean onRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onRightClick(EntityPlayer player, EnumFacing side)
{
return false;
return EnumActionResult.PASS;
}
public static void register()
@@ -66,7 +66,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData
motionZ = motion.zCoord;
owner = player;
mode = ((ItemFlamethrower)player.getCurrentEquippedItem().getItem()).getMode(player.getCurrentEquippedItem());
mode = ((ItemFlamethrower)player.inventory.getCurrentItem().getItem()).getMode(player.inventory.getCurrentItem());
}
public void setHeading(Pos3D motion)
@@ -6,6 +6,7 @@ import net.minecraft.inventory.InventoryBasic;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumHand;
public class InventoryPersonalChest extends InventoryBasic
{
@@ -13,11 +14,14 @@ public class InventoryPersonalChest extends InventoryBasic
public ItemStack itemStack;
public boolean reading;
public EnumHand currentHand = EnumHand.MAIN_HAND;
public InventoryPersonalChest(EntityPlayer player)
public InventoryPersonalChest(EntityPlayer player, EnumHand hand)
{
super("PersonalChest", false, 55);
entityPlayer = player;
currentHand = hand;
read();
}
@@ -104,6 +108,6 @@ public class InventoryPersonalChest extends InventoryBasic
public ItemStack getStack()
{
return itemStack != null ? itemStack : entityPlayer.getCurrentEquippedItem();
return itemStack != null ? itemStack : entityPlayer.getHeldItem(currentHand);
}
}
@@ -16,6 +16,8 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
@@ -76,7 +78,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand)
{
if(!world.isRemote)
{
@@ -90,7 +92,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
itemstack.stackSize--;
}
return itemstack;
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
@Override
@@ -113,7 +115,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
if(player.isSneaking())
{
@@ -123,7 +125,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
if(balloonsNear.size() > 0)
{
return true;
return EnumActionResult.FAIL;
}
if(world.getBlockState(pos).getBlock().isReplaceable(world, pos))
@@ -133,7 +135,7 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
if(!world.isSideSolid(pos, EnumFacing.UP))
{
return true;
return EnumActionResult.FAIL;
}
if(canReplace(world, pos.up()) && canReplace(world, pos.up(2)))
@@ -146,12 +148,14 @@ public class ItemBalloon extends ItemMekanism implements IMetaItem
world.spawnEntityInWorld(new EntityBalloon(world, new Coord4D(pos, world), getColor(stack)));
stack.stackSize--;
}
return EnumActionResult.SUCCESS;
}
return true;
return EnumActionResult.FAIL;
}
return false;
return EnumActionResult.PASS;
}
@Override
@@ -18,7 +18,9 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
@@ -67,7 +69,7 @@ public class ItemBlockCardboardBox extends ItemBlock
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
{
if(!player.isSneaking() && !world.isAirBlock(pos) && stack.getItemDamage() == 0)
{
@@ -108,11 +110,11 @@ public class ItemBlockCardboardBox extends ItemBlock
tileEntity.storedData = data;
}
return true;
return EnumActionResult.SUCCESS;
}
}
return false;
return EnumActionResult.PASS;
}
@Override
@@ -54,7 +54,10 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
@@ -253,16 +256,16 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
MachineType type = MachineType.get(stack);
if(type == MachineType.FLUID_TANK && getBucketMode(stack))
{
return false;
return EnumActionResult.PASS;
}
return super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ);
return super.onItemUse(stack, player, world, pos, hand, side, hitX, hitY, hitZ);
}
@Override
@@ -464,7 +467,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand)
{
MachineType type = MachineType.get(itemstack);
@@ -479,7 +482,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
if(SecurityUtils.canAccess(entityplayer, itemstack))
{
InventoryPersonalChest inventory = new InventoryPersonalChest(entityplayer);
InventoryPersonalChest inventory = new InventoryPersonalChest(entityplayer, hand);
MekanismUtils.openPersonalChestGui((EntityPlayerMP)entityplayer, null, inventory, false);
}
else {
@@ -495,75 +498,75 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
if(pos == null)
{
return itemstack;
return new ActionResult(EnumActionResult.FAIL, itemstack);
}
else {
if(pos.typeOfHit == RayTraceResult.Type.BLOCK)
{
Coord4D coord = new Coord4D(pos.getBlockPos(), world);
else {
if(pos.typeOfHit == RayTraceResult.Type.BLOCK)
{
Coord4D coord = new Coord4D(pos.getBlockPos(), world);
if(!world.provider.canMineBlock(entityplayer, coord.getPos()))
{
return new ActionResult(EnumActionResult.FAIL, itemstack);
}
if(!entityplayer.isSneaking())
{
if(!entityplayer.canPlayerEdit(coord.getPos(), pos.sideHit, itemstack))
{
return new ActionResult(EnumActionResult.FAIL, itemstack);
}
FluidStack fluid = MekanismUtils.getFluid(world, coord, false);
if(fluid != null && (getFluidStack(itemstack) == null || getFluidStack(itemstack).isFluidEqual(fluid)))
{
int needed = getCapacity(itemstack)-(getFluidStack(itemstack) != null ? getFluidStack(itemstack).amount : 0);
if(fluid.amount > needed)
{
return new ActionResult(EnumActionResult.FAIL, itemstack);
}
if(getFluidStack(itemstack) == null)
{
setFluidStack(fluid, itemstack);
}
else {
FluidStack newStack = getFluidStack(itemstack);
newStack.amount += fluid.amount;
setFluidStack(newStack, itemstack);
}
world.setBlockToAir(coord.getPos());
}
}
else {
FluidStack stored = getFluidStack(itemstack);
if(stored == null || stored.amount < FluidContainerRegistry.BUCKET_VOLUME)
{
return new ActionResult(EnumActionResult.FAIL, itemstack);
}
Coord4D trans = coord.offset(pos.sideHit);
if(!world.provider.canMineBlock(entityplayer, coord.getPos()))
{
return itemstack;
}
if(!entityplayer.canPlayerEdit(trans.getPos(), pos.sideHit, itemstack))
{
return new ActionResult(EnumActionResult.FAIL, itemstack);
}
if(!entityplayer.isSneaking())
{
if(!entityplayer.canPlayerEdit(coord.getPos(), pos.sideHit, itemstack))
{
return itemstack;
}
FluidStack fluid = MekanismUtils.getFluid(world, coord, false);
if(fluid != null && (getFluidStack(itemstack) == null || getFluidStack(itemstack).isFluidEqual(fluid)))
{
int needed = getCapacity(itemstack)-(getFluidStack(itemstack) != null ? getFluidStack(itemstack).amount : 0);
if(fluid.amount > needed)
{
return itemstack;
}
if(getFluidStack(itemstack) == null)
{
setFluidStack(fluid, itemstack);
}
else {
FluidStack newStack = getFluidStack(itemstack);
newStack.amount += fluid.amount;
setFluidStack(newStack, itemstack);
}
world.setBlockToAir(coord.getPos());
}
}
else {
FluidStack stored = getFluidStack(itemstack);
if(stored == null || stored.amount < FluidContainerRegistry.BUCKET_VOLUME)
{
return itemstack;
}
Coord4D trans = coord.offset(pos.sideHit);
if(!entityplayer.canPlayerEdit(trans.getPos(), pos.sideHit, itemstack))
{
return itemstack;
}
if(tryPlaceContainedLiquid(world, itemstack, trans.getPos()) && !entityplayer.capabilities.isCreativeMode)
{
FluidStack newStack = stored.copy();
newStack.amount -= FluidContainerRegistry.BUCKET_VOLUME;
setFluidStack(newStack.amount > 0 ? newStack : null, itemstack);
}
}
}
return itemstack;
if(tryPlaceContainedLiquid(world, itemstack, trans.getPos()) && !entityplayer.capabilities.isCreativeMode)
{
FluidStack newStack = stored.copy();
newStack.amount -= FluidContainerRegistry.BUCKET_VOLUME;
setFluidStack(newStack.amount > 0 ? newStack : null, itemstack);
}
}
}
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
}
else {
@@ -571,7 +574,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
}
}
return itemstack;
return new ActionResult(EnumActionResult.PASS, itemstack);
}
@Override
@@ -15,7 +15,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
@@ -38,7 +40,7 @@ public class ItemConfigurationCard extends ItemMekanism
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
{
if(!world.isRemote)
{
@@ -62,7 +64,7 @@ public class ItemConfigurationCard extends ItemMekanism
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurationCard.got").replaceAll("%s", EnumColor.INDIGO + LangUtils.localize(data.getString("dataType")) + EnumColor.GREY)));
}
return true;
return EnumActionResult.SUCCESS;
}
else if(getData(stack) != null)
{
@@ -82,12 +84,12 @@ public class ItemConfigurationCard extends ItemMekanism
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.configurationCard.unequal") + "."));
}
return true;
return EnumActionResult.SUCCESS;
}
}
}
return false;
return EnumActionResult.FAIL;
}
private NBTTagCompound getBaseData(TileEntity tile)
@@ -32,7 +32,9 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockAccess;
@@ -66,7 +68,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
{
if(!world.isRemote)
{
@@ -109,7 +111,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
}
}
return true;
return EnumActionResult.SUCCESS;
}
else if(MekanismUtils.hasCapability(tile, Capabilities.CONFIGURABLE_CAPABILITY, side))
{
@@ -128,7 +130,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
else {
SecurityUtils.displayNoAccess(player);
return true;
return EnumActionResult.SUCCESS;
}
}
}
@@ -184,11 +186,11 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
}
}
return true;
return EnumActionResult.SUCCESS;
}
else {
SecurityUtils.displayNoAccess(player);
return true;
return EnumActionResult.FAIL;
}
}
}
@@ -205,15 +207,15 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
block.rotateBlock(world, pos, side.getOpposite());
}
return true;
return EnumActionResult.SUCCESS;
}
else if(getState(stack) == ConfiguratorMode.WRENCH) //Wrench
{
return false;
return EnumActionResult.PASS;
}
}
return false;
return EnumActionResult.PASS;
}
public String getViewModeText(TransmissionType type)
@@ -13,6 +13,9 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -75,19 +78,22 @@ public class ItemCraftingFormula extends ItemMekanism
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if(player.isSneaking() && !world.isRemote)
if(player.isSneaking())
{
setInventory(stack, null);
setInvalid(stack, false);
if(!world.isRemote)
{
setInventory(stack, null);
setInvalid(stack, false);
((EntityPlayerMP)player).sendContainerToPlayer(player.openContainer);
}
((EntityPlayerMP)player).sendContainerToPlayer(player.openContainer);
return stack;
return new ActionResult(EnumActionResult.SUCCESS, stack);
}
return stack;
return new ActionResult(EnumActionResult.PASS, stack);
}
@Override
@@ -10,7 +10,10 @@ import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
@@ -24,7 +27,7 @@ public class ItemDictionary extends ItemMekanism
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
{
if(!player.isSneaking())
{
@@ -52,21 +55,21 @@ public class ItemDictionary extends ItemMekanism
}
}
return true;
return EnumActionResult.SUCCESS;
}
}
return false;
return EnumActionResult.PASS;
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand)
{
if(entityplayer.isSneaking())
{
entityplayer.openGui(Mekanism.instance, 0, world, 0, 0, 0);
}
return itemstack;
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
}
@@ -2,17 +2,28 @@ package mekanism.common.item;
import java.util.List;
import javax.annotation.Nullable;
import mekanism.api.EnumColor;
import mekanism.common.util.ItemDataUtils;
import mekanism.common.util.LangUtils;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Enchantments;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemArrow;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
public class ItemElectricBow extends ItemEnergized
{
@@ -31,15 +42,25 @@ public class ItemElectricBow extends ItemEnergized
}
@Override
public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer player, int itemUseCount)
public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityLivingBase entityLiving, int itemUseCount)
{
if(getEnergy(itemstack) > 0)
if(entityLiving instanceof EntityPlayer && getEnergy(itemstack) > 0)
{
boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, itemstack) > 0;
EntityPlayer player = (EntityPlayer)entityLiving;
boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.INFINITY, itemstack) > 0;
ItemStack ammo = findAmmo(player);
int maxItemUse = getMaxItemUseDuration(itemstack) - itemUseCount;
maxItemUse = ForgeEventFactory.onArrowLoose(itemstack, world, player, maxItemUse, itemstack != null || flag);
if(maxItemUse < 0) return;
if(flag || player.inventory.hasItem(Items.arrow))
if(flag || ammo != null)
{
int maxItemUse = getMaxItemUseDuration(itemstack) - itemUseCount;
if(ammo == null)
{
ammo = new ItemStack(Items.ARROW);
}
float f = maxItemUse / 20F;
f = (f * f + f * 2.0F) / 3F;
@@ -52,34 +73,48 @@ public class ItemElectricBow extends ItemEnergized
{
f = 1.0F;
}
EntityArrow entityarrow = new EntityArrow(world, player, f * 2.0F);
if(f == 1.0F)
{
entityarrow.setIsCritical(true);
}
if(!player.capabilities.isCreativeMode)
{
setEnergy(itemstack, getEnergy(itemstack) - (getFireState(itemstack) ? 1200 : 120));
}
world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if(flag)
{
entityarrow.canBePickedUp = 2;
}
else {
player.inventory.consumeInventoryItem(Items.arrow);
}
boolean noConsume = flag && itemstack.getItem() instanceof ItemArrow;
if(!world.isRemote)
{
world.spawnEntityInWorld(entityarrow);
entityarrow.setFire(getFireState(itemstack) ? 60 : 0);
ItemArrow itemarrow = (ItemArrow)(ammo.getItem() instanceof ItemArrow ? ammo.getItem() : Items.ARROW);
EntityArrow entityarrow = itemarrow.createArrow(world, itemstack, player);
entityarrow.setAim(player, player.rotationPitch, player.rotationYaw, 0.0F, f * 3.0F, 1.0F);
if(f == 1.0F)
{
entityarrow.setIsCritical(true);
}
if(!player.capabilities.isCreativeMode)
{
setEnergy(itemstack, getEnergy(itemstack) - (getFireState(itemstack) ? 1200 : 120));
}
if(noConsume)
{
entityarrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
entityarrow.setFire(getFireState(itemstack) ? 100 : 0);
world.spawnEntityInWorld(entityarrow);
}
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if(!noConsume)
{
itemstack.stackSize--;
if(itemstack.stackSize == 0)
{
player.inventory.deleteStack(itemstack);
}
}
player.addStat(StatList.getObjectUseStats(this));
}
}
}
@@ -95,16 +130,53 @@ public class ItemElectricBow extends ItemEnergized
{
return EnumAction.BOW;
}
private ItemStack findAmmo(EntityPlayer player)
{
if(isArrow(player.getHeldItem(EnumHand.OFF_HAND)))
{
return player.getHeldItem(EnumHand.OFF_HAND);
}
else if(isArrow(player.getHeldItem(EnumHand.MAIN_HAND)))
{
return player.getHeldItem(EnumHand.MAIN_HAND);
}
else {
for(int i = 0; i < player.inventory.getSizeInventory(); ++i)
{
ItemStack itemstack = player.inventory.getStackInSlot(i);
if(isArrow(itemstack))
{
return itemstack;
}
}
return null;
}
}
protected boolean isArrow(@Nullable ItemStack stack)
{
return stack != null && stack.getItem() instanceof ItemArrow;
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
if(entityplayer.capabilities.isCreativeMode || entityplayer.inventory.hasItem(Items.arrow))
{
entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
}
boolean flag = findAmmo(playerIn) != null;
return itemstack;
ActionResult<ItemStack> ret = ForgeEventFactory.onArrowNock(itemStackIn, worldIn, playerIn, hand, flag);
if(ret != null) return ret;
if(!playerIn.capabilities.isCreativeMode && !flag)
{
return !flag ? new ActionResult(EnumActionResult.FAIL, itemStackIn) : new ActionResult(EnumActionResult.PASS, itemStackIn);
}
else {
playerIn.setActiveHand(hand);
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
}
public void setFireState(ItemStack itemstack, boolean state)
@@ -18,7 +18,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -32,11 +34,11 @@ public class ItemFactoryInstaller extends ItemMekanism implements IMetaItem
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
{
if(world.isRemote)
{
return false;
return EnumActionResult.PASS;
}
TileEntity tile = world.getTileEntity(pos);
@@ -44,7 +46,7 @@ public class ItemFactoryInstaller extends ItemMekanism implements IMetaItem
if(tile instanceof TileEntityBasicBlock && ((TileEntityBasicBlock)tile).playersUsing.size() > 0)
{
return true;
return EnumActionResult.FAIL;
}
if(tile instanceof TileEntityFactory && tier != FactoryTier.BASIC)
@@ -63,7 +65,7 @@ public class ItemFactoryInstaller extends ItemMekanism implements IMetaItem
stack.stackSize = 0;
}
return true;
return EnumActionResult.SUCCESS;
}
}
else if(tile != null && tier == FactoryTier.BASIC)
@@ -74,6 +76,7 @@ public class ItemFactoryInstaller extends ItemMekanism implements IMetaItem
{
ItemStack machineStack = iterType.getStack();
IBlockState state = world.getBlockState(pos);
if(Block.getBlockFromItem(machineStack.getItem()) == state.getBlock() && machineStack.getItemDamage() == state.getBlock().getMetaFromState(state))
{
type = iterType;
@@ -92,7 +95,7 @@ public class ItemFactoryInstaller extends ItemMekanism implements IMetaItem
stack.stackSize = 0;
}
return true;
return EnumActionResult.SUCCESS;
}
else if(tile instanceof TileEntityAdvancedElectricMachine)
{
@@ -103,7 +106,7 @@ public class ItemFactoryInstaller extends ItemMekanism implements IMetaItem
stack.stackSize = 0;
}
return true;
return EnumActionResult.SUCCESS;
}
else if(tile instanceof TileEntityMetallurgicInfuser)
{
@@ -114,12 +117,12 @@ public class ItemFactoryInstaller extends ItemMekanism implements IMetaItem
stack.stackSize = 0;
}
return true;
return EnumActionResult.SUCCESS;
}
}
}
return false;
return EnumActionResult.PASS;
}
private int getOutputSlot(FactoryTier tier, int operation)
@@ -14,6 +14,9 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
@@ -64,7 +67,7 @@ public class ItemGaugeDropper extends ItemMekanism implements IGasItem, IFluidCo
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{
if(player.isSneaking() && !world.isRemote)
{
@@ -73,10 +76,10 @@ public class ItemGaugeDropper extends ItemMekanism implements IGasItem, IFluidCo
((EntityPlayerMP)player).sendContainerToPlayer(player.openContainer);
return stack;
return new ActionResult(EnumActionResult.SUCCESS, stack);
}
return stack;
return new ActionResult(EnumActionResult.PASS, stack);
}
@Override
@@ -15,7 +15,9 @@ import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
@@ -30,7 +32,7 @@ public class ItemNetworkReader extends ItemEnergized
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
{
if(!world.isRemote)
{
@@ -61,7 +63,7 @@ public class ItemNetworkReader extends ItemEnergized
player.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
return true;
return EnumActionResult.SUCCESS;
}
else if(MekanismUtils.hasCapability(tileEntity, Capabilities.HEAT_TRANSFER_CAPABILITY, side.getOpposite()))
{
@@ -72,7 +74,7 @@ public class ItemNetworkReader extends ItemEnergized
player.addChatMessage(new TextComponentString(EnumColor.GREY + " *Temperature: " + EnumColor.DARK_GREY + transfer.getTemp() + "K above ambient"));
player.addChatMessage(new TextComponentString(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
return true;
return EnumActionResult.SUCCESS;
}
else {
if(drain) setEnergy(stack, getEnergy(stack)-ENERGY_PER_USE);
@@ -100,7 +102,7 @@ public class ItemNetworkReader extends ItemEnergized
}
}
return true;
return EnumActionResult.SUCCESS;
}
}
@@ -118,7 +120,7 @@ public class ItemNetworkReader extends ItemEnergized
}
}
return false;
return EnumActionResult.PASS;
}
@Override
@@ -15,6 +15,9 @@ import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
@@ -46,7 +49,7 @@ public class ItemPortableTeleporter extends ItemEnergized implements IOwnerItem
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand)
{
if(!world.isRemote)
{
@@ -58,7 +61,7 @@ public class ItemPortableTeleporter extends ItemEnergized implements IOwnerItem
else {
if(SecurityUtils.canAccess(entityplayer, itemstack))
{
entityplayer.openGui(Mekanism.instance, 14, world, 0, 0, 0);
entityplayer.openGui(Mekanism.instance, 14, world, hand.ordinal(), 0, 0);
}
else {
SecurityUtils.displayNoAccess(entityplayer);
@@ -66,7 +69,7 @@ public class ItemPortableTeleporter extends ItemEnergized implements IOwnerItem
}
}
return itemstack;
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
public static double calculateEnergyCost(Entity entity, Coord4D coords)
@@ -13,7 +13,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -37,13 +39,14 @@ public class ItemRobit extends ItemEnergized implements ISustainedInventory
}
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, BlockPos pos, EnumFacing side, float posX, float posY, float posZ)
public EnumActionResult onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, BlockPos pos, EnumHand hand, EnumFacing side, float posX, float posY, float posZ)
{
TileEntity tileEntity = world.getTileEntity(pos);
if(tileEntity instanceof TileEntityChargepad)
{
TileEntityChargepad chargepad = (TileEntityChargepad)tileEntity;
if(!chargepad.isActive)
{
if(!world.isRemote)
@@ -59,13 +62,13 @@ public class ItemRobit extends ItemEnergized implements ISustainedInventory
world.spawnEntityInWorld(robit);
}
entityplayer.setCurrentItemOrArmor(0, null);
entityplayer.setHeldItem(hand, null);
return true;
return EnumActionResult.SUCCESS;
}
}
return false;
return EnumActionResult.PASS;
}
@Override
@@ -7,6 +7,9 @@ import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
@@ -26,7 +29,7 @@ public class ItemSeismicReader extends ItemEnergized
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand)
{
Chunk3D chunk = new Chunk3D(entityplayer);
@@ -37,7 +40,7 @@ public class ItemSeismicReader extends ItemEnergized
entityplayer.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.seismicReader.needsEnergy")));
}
return itemstack;
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
else if(!MekanismUtils.isChunkVibrated(chunk))
{
@@ -46,7 +49,7 @@ public class ItemSeismicReader extends ItemEnergized
entityplayer.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.RED + LangUtils.localize("tooltip.seismicReader.noVibrations")));
}
return itemstack;
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
if(!entityplayer.capabilities.isCreativeMode)
@@ -54,8 +57,8 @@ public class ItemSeismicReader extends ItemEnergized
setEnergy(itemstack, getEnergy(itemstack)-ENERGY_USAGE);
}
entityplayer.openGui(Mekanism.instance, 38, world, (int)entityplayer.posX, (int)entityplayer.posY, (int)entityplayer.posZ);
entityplayer.openGui(Mekanism.instance, 38, world, hand.ordinal(), 0, 0);
return itemstack;
return new ActionResult(EnumActionResult.PASS, itemstack);
}
}
@@ -10,6 +10,9 @@ import mekanism.common.util.LangUtils;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
public class ItemWalkieTalkie extends ItemMekanism
@@ -44,14 +47,16 @@ public class ItemWalkieTalkie extends ItemMekanism
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player, EnumHand hand)
{
if(player.isSneaking())
{
setOn(itemStack, !getOn(itemStack));
return new ActionResult(EnumActionResult.SUCCESS, itemStack);
}
return itemStack;
return new ActionResult(EnumActionResult.PASS, itemStack);
}
@Override
@@ -41,7 +41,7 @@ public class ItemPartTransmitter extends ItemMultiPart implements IMetaItem
setHasSubtypes(true);
setCreativeTab(Mekanism.tabMekanism);
}
@Override
public IMultipart createPart(World world, BlockPos pos, EnumFacing dir, Vec3d hit, ItemStack stack, EntityPlayer player)
{
@@ -14,6 +14,7 @@ import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextComponentString;
@@ -105,7 +106,7 @@ public class PartDiversionTransporter extends PartLogisticalTransporter
}
@Override
protected boolean onConfigure(EntityPlayer player, int part, EnumFacing side)
protected EnumActionResult onConfigure(EntityPlayer player, int part, EnumFacing side)
{
int newMode = (modes[side.ordinal()] + 1) % 3;
String description = "ERROR";
@@ -132,7 +133,7 @@ public class PartDiversionTransporter extends PartLogisticalTransporter
Coord4D coord = new Coord4D(getPos(), getWorld());
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(coord, getNetworkedData(new ArrayList<Object>())), new Range4D(coord));
return true;
return EnumActionResult.SUCCESS;
}
@Override
@@ -33,6 +33,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextComponentString;
@@ -333,7 +334,7 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
}
@Override
protected boolean onConfigure(EntityPlayer player, int part, EnumFacing side)
protected EnumActionResult onConfigure(EntityPlayer player, int part, EnumFacing side)
{
TransporterUtils.incrementColor(getTransmitter());
refreshConnections();
@@ -342,15 +343,16 @@ public class PartLogisticalTransporter extends PartTransmitter<IInventory, Inven
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(new Coord4D(getPos(), getWorld()), getNetworkedData(new ArrayList())), new Range4D(new Coord4D(getPos(), getWorld())));
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.configurator.toggleColor") + ": " + (getTransmitter().getColor() != null ? getTransmitter().getColor().getColoredName() : EnumColor.BLACK + LangUtils.localize("gui.none"))));
return true;
return EnumActionResult.SUCCESS;
}
@Override
public boolean onRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onRightClick(EntityPlayer player, EnumFacing side)
{
super.onRightClick(player, side);
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " " + LangUtils.localize("tooltip.configurator.viewColor") + ": " + (getTransmitter().getColor() != null ? getTransmitter().getColor().getColoredName() : "None")));
return true;
return EnumActionResult.SUCCESS;
}
@Override
@@ -1,6 +1,7 @@
package mekanism.common.multipart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
@@ -31,8 +32,8 @@ public class PartRestrictiveTransporter extends PartLogisticalTransporter
}
@Override
protected boolean onConfigure(EntityPlayer player, int part, EnumFacing side)
protected EnumActionResult onConfigure(EntityPlayer player, int part, EnumFacing side)
{
return false;
return EnumActionResult.PASS;
}
}
@@ -37,6 +37,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.IStringSerializable;
@@ -791,7 +792,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
}
@Override
public boolean onSneakRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side)
{
if(!getWorld().isRemote)
{
@@ -799,7 +800,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
if(hit == null)
{
return false;
return EnumActionResult.PASS;
}
else {
EnumFacing hitSide = sideHit(hit.subHit + 1);
@@ -812,7 +813,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
onModeChange(EnumFacing.getFront(hitSide.ordinal()));
player.addChatMessage(new TextComponentString("Connection type changed to " + connectionTypes[hitSide.ordinal()].toString()));
return true;
return EnumActionResult.SUCCESS;
}
else {
return onConfigure(player, 6, side);
@@ -820,7 +821,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
}
}
return true;
return EnumActionResult.SUCCESS;
}
private PartMOP reTrace(World world, BlockPos pos, EntityPlayer player)
@@ -855,9 +856,9 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
return null;
}
protected boolean onConfigure(EntityPlayer player, int part, EnumFacing side)
protected EnumActionResult onConfigure(EntityPlayer player, int part, EnumFacing side)
{
return false;
return EnumActionResult.PASS;
}
public EnumColor getRenderColor()
@@ -866,7 +867,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
}
@Override
public boolean onRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onRightClick(EntityPlayer player, EnumFacing side)
{
if(!getWorld().isRemote && handlesRedstone())
{
@@ -877,7 +878,7 @@ public abstract class PartSidedPipe extends Multipart implements INormallyOcclud
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " Redstone sensitivity turned " + EnumColor.INDIGO + (redstoneReactive ? "on." : "off.")));
}
return true;
return EnumActionResult.SUCCESS;
}
@Override
@@ -6,6 +6,7 @@ import mekanism.common.item.ItemConfigurator;
import mekanism.common.item.ItemConfigurator.ConfiguratorMode;
import mekanism.common.network.PacketConfiguratorState.ConfiguratorStateMessage;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
@@ -15,7 +16,7 @@ public class PacketConfiguratorState implements IMessageHandler<ConfiguratorStat
@Override
public IMessage onMessage(ConfiguratorStateMessage message, MessageContext context)
{
ItemStack itemstack = PacketHandler.getPlayer(context).getCurrentEquippedItem();
ItemStack itemstack = PacketHandler.getPlayer(context).getHeldItem(message.currentHand);
if(itemstack != null && itemstack.getItem() instanceof ItemConfigurator)
{
@@ -27,24 +28,29 @@ public class PacketConfiguratorState implements IMessageHandler<ConfiguratorStat
public static class ConfiguratorStateMessage implements IMessage
{
public EnumHand currentHand;
public ConfiguratorMode state;
public ConfiguratorStateMessage() {}
public ConfiguratorStateMessage(ConfiguratorMode s)
public ConfiguratorStateMessage(EnumHand hand, ConfiguratorMode s)
{
currentHand = hand;
state = s;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(currentHand.ordinal());
dataStream.writeInt(state.ordinal());
}
@Override
public void fromBytes(ByteBuf dataStream)
{
currentHand = EnumHand.values()[dataStream.readInt()];
state = ConfiguratorMode.values()[dataStream.readInt()];
}
}
@@ -5,6 +5,7 @@ import mekanism.common.PacketHandler;
import mekanism.common.item.ItemElectricBow;
import mekanism.common.network.PacketElectricBowState.ElectricBowStateMessage;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
@@ -14,7 +15,7 @@ public class PacketElectricBowState implements IMessageHandler<ElectricBowStateM
@Override
public IMessage onMessage(ElectricBowStateMessage message, MessageContext context)
{
ItemStack itemstack = PacketHandler.getPlayer(context).getCurrentEquippedItem();
ItemStack itemstack = PacketHandler.getPlayer(context).getHeldItem(message.currentHand);
if(itemstack != null && itemstack.getItem() instanceof ItemElectricBow)
{
@@ -26,24 +27,29 @@ public class PacketElectricBowState implements IMessageHandler<ElectricBowStateM
public static class ElectricBowStateMessage implements IMessage
{
public EnumHand currentHand;
public boolean fireMode;
public ElectricBowStateMessage() {}
public ElectricBowStateMessage(boolean state)
public ElectricBowStateMessage(EnumHand hand, boolean state)
{
currentHand = hand;
fireMode = state;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(currentHand.ordinal());
dataStream.writeBoolean(fireMode);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
currentHand = EnumHand.values()[dataStream.readInt()];
fireMode = dataStream.readBoolean();
}
}
@@ -7,6 +7,7 @@ import mekanism.common.item.ItemFlamethrower;
import mekanism.common.network.PacketFlamethrowerData.FlamethrowerDataMessage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
@@ -30,12 +31,12 @@ public class PacketFlamethrowerData implements IMessageHandler<FlamethrowerDataM
if(!player.worldObj.isRemote)
{
Mekanism.packetHandler.sendToDimension(new FlamethrowerDataMessage(FlamethrowerPacket.UPDATE, message.username, message.value), player.worldObj.provider.getDimension());
Mekanism.packetHandler.sendToDimension(new FlamethrowerDataMessage(FlamethrowerPacket.UPDATE, message.currentHand, message.username, message.value), player.worldObj.provider.getDimension());
}
}
else if(message.packetType == FlamethrowerPacket.MODE)
{
ItemStack stack = player.getCurrentEquippedItem();
ItemStack stack = player.getHeldItem(message.currentHand);
if(stack != null && stack.getItem() instanceof ItemFlamethrower)
{
@@ -50,12 +51,13 @@ public class PacketFlamethrowerData implements IMessageHandler<FlamethrowerDataM
{
public FlamethrowerPacket packetType;
public EnumHand currentHand;
public String username;
public boolean value;
public FlamethrowerDataMessage() {}
public FlamethrowerDataMessage(FlamethrowerPacket type, String name, boolean state)
public FlamethrowerDataMessage(FlamethrowerPacket type, EnumHand hand, String name, boolean state)
{
packetType = type;
@@ -63,6 +65,10 @@ public class PacketFlamethrowerData implements IMessageHandler<FlamethrowerDataM
{
username = name;
value = state;
}
else if(type == FlamethrowerPacket.MODE)
{
currentHand = hand;
}
}
@@ -75,6 +81,9 @@ public class PacketFlamethrowerData implements IMessageHandler<FlamethrowerDataM
{
PacketHandler.writeString(dataStream, username);
dataStream.writeBoolean(value);
}
else {
dataStream.writeInt(currentHand.ordinal());
}
}
@@ -87,6 +96,10 @@ public class PacketFlamethrowerData implements IMessageHandler<FlamethrowerDataM
{
username = PacketHandler.readString(dataStream);
value = dataStream.readBoolean();
}
else if(packetType == FlamethrowerPacket.MODE)
{
currentHand = EnumHand.values()[dataStream.readInt()];
}
}
}
@@ -12,6 +12,7 @@ import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
@@ -33,11 +34,11 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
MekanismUtils.openPersonalChestGui((EntityPlayerMP)player, tileEntity, null, true);
}
else {
ItemStack stack = player.getCurrentEquippedItem();
ItemStack stack = player.getHeldItem(message.currentHand);
if(MachineType.get(stack) == MachineType.PERSONAL_CHEST)
{
InventoryPersonalChest inventory = new InventoryPersonalChest(player);
InventoryPersonalChest inventory = new InventoryPersonalChest(player, message.currentHand);
MekanismUtils.openPersonalChestGui((EntityPlayerMP)player, null, inventory, false);
}
}
@@ -49,7 +50,7 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
else if(message.packetType == PersonalChestPacketType.CLIENT_OPEN)
{
try {
Mekanism.proxy.openPersonalChest(player, message.guiType, message.windowId, message.isBlock, message.coord4D == null ? BlockPos.ORIGIN : message.coord4D.getPos());
Mekanism.proxy.openPersonalChest(player, message.guiType, message.windowId, message.isBlock, message.coord4D == null ? BlockPos.ORIGIN : message.coord4D.getPos(), message.currentHand);
} catch(Exception e) {
Mekanism.logger.error("Error while handling electric chest open packet.");
e.printStackTrace();
@@ -70,10 +71,12 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
public Coord4D coord4D;
public EnumHand currentHand;
public PersonalChestMessage() {}
//This is a really messy implementation...
public PersonalChestMessage(PersonalChestPacketType type, boolean b1, int i1, int i2, Coord4D c1)
public PersonalChestMessage(PersonalChestPacketType type, boolean b1, int i1, int i2, Coord4D c1, EnumHand hand)
{
packetType = type;
@@ -88,6 +91,9 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
{
coord4D = c1;
}
else {
currentHand = hand;
}
break;
case SERVER_OPEN:
@@ -97,6 +103,9 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
{
coord4D = c1;
}
else {
currentHand = hand;
}
break;
}
@@ -118,6 +127,9 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
{
coord4D.write(dataStream);
}
else {
dataStream.writeInt(currentHand.ordinal());
}
break;
case SERVER_OPEN:
@@ -127,6 +139,9 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
{
coord4D.write(dataStream);
}
else {
dataStream.writeInt(currentHand.ordinal());
}
break;
}
@@ -145,6 +160,9 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
else {
currentHand = EnumHand.values()[dataStream.readInt()];
}
}
else if(packetType == PersonalChestPacketType.CLIENT_OPEN)
{
@@ -156,6 +174,9 @@ public class PacketPersonalChest implements IMessageHandler<PersonalChestMessage
{
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
else {
currentHand = EnumHand.values()[dataStream.readInt()];
}
}
}
}
@@ -5,6 +5,7 @@ import mekanism.common.PacketHandler;
import mekanism.common.item.ItemBlockMachine;
import mekanism.common.network.PacketPortableTankState.PortableTankStateMessage;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
@@ -14,7 +15,7 @@ public class PacketPortableTankState implements IMessageHandler<PortableTankStat
@Override
public IMessage onMessage(PortableTankStateMessage message, MessageContext context)
{
ItemStack itemstack = PacketHandler.getPlayer(context).getCurrentEquippedItem();
ItemStack itemstack = PacketHandler.getPlayer(context).getHeldItem(message.currentHand);
if(itemstack != null && itemstack.getItem() instanceof ItemBlockMachine)
{
@@ -26,24 +27,29 @@ public class PacketPortableTankState implements IMessageHandler<PortableTankStat
public static class PortableTankStateMessage implements IMessage
{
public EnumHand currentHand;
public boolean bucketMode;
public PortableTankStateMessage() {}
public PortableTankStateMessage(boolean state)
public PortableTankStateMessage(EnumHand hand, boolean state)
{
currentHand = hand;
bucketMode = state;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(currentHand.ordinal());
dataStream.writeBoolean(bucketMode);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
currentHand = EnumHand.values()[dataStream.readInt()];
bucketMode = dataStream.readBoolean();
}
}
@@ -22,6 +22,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLCommonHandler;
@@ -35,7 +36,7 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
public IMessage onMessage(PortableTeleporterMessage message, MessageContext context)
{
EntityPlayer player = PacketHandler.getPlayer(context);
ItemStack itemstack = player.getCurrentEquippedItem();
ItemStack itemstack = player.getHeldItem(message.currentHand);
World world = player.worldObj;
if(itemstack != null && itemstack.getItem() instanceof ItemPortableTeleporter)
@@ -221,6 +222,8 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
public static class PortableTeleporterMessage implements IMessage
{
public PortableTeleporterPacketType packetType;
public EnumHand currentHand;
public Frequency frequency;
public byte status;
@@ -229,9 +232,10 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
public PortableTeleporterMessage() {}
public PortableTeleporterMessage(PortableTeleporterPacketType type, Frequency freq)
public PortableTeleporterMessage(PortableTeleporterPacketType type, EnumHand hand, Frequency freq)
{
packetType = type;
currentHand = hand;
if(type == PortableTeleporterPacketType.DATA_REQUEST)
{
@@ -269,6 +273,8 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
if(packetType == PortableTeleporterPacketType.DATA_REQUEST)
{
buffer.writeInt(currentHand.ordinal());
if(frequency != null)
{
buffer.writeBoolean(true);
@@ -312,16 +318,19 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
}
else if(packetType == PortableTeleporterPacketType.SET_FREQ)
{
buffer.writeInt(currentHand.ordinal());
PacketHandler.writeString(buffer, frequency.name);
buffer.writeBoolean(frequency.publicFreq);
}
else if(packetType == PortableTeleporterPacketType.DEL_FREQ)
{
buffer.writeInt(currentHand.ordinal());
PacketHandler.writeString(buffer, frequency.name);
buffer.writeBoolean(frequency.publicFreq);
}
else if(packetType == PortableTeleporterPacketType.TELEPORT)
{
buffer.writeInt(currentHand.ordinal());
PacketHandler.writeString(buffer, frequency.name);
buffer.writeBoolean(frequency.publicFreq);
}
@@ -334,6 +343,8 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
if(packetType == PortableTeleporterPacketType.DATA_REQUEST)
{
currentHand = EnumHand.values()[buffer.readInt()];
if(buffer.readBoolean())
{
frequency = new Frequency(PacketHandler.readString(buffer), null).setPublic(buffer.readBoolean());
@@ -364,14 +375,17 @@ public class PacketPortableTeleporter implements IMessageHandler<PortableTelepor
}
else if(packetType == PortableTeleporterPacketType.SET_FREQ)
{
currentHand = EnumHand.values()[buffer.readInt()];
frequency = new Frequency(PacketHandler.readString(buffer), null).setPublic(buffer.readBoolean());
}
else if(packetType == PortableTeleporterPacketType.DEL_FREQ)
{
currentHand = EnumHand.values()[buffer.readInt()];
frequency = new Frequency(PacketHandler.readString(buffer), null).setPublic(buffer.readBoolean());
}
else if(packetType == PortableTeleporterPacketType.TELEPORT)
{
currentHand = EnumHand.values()[buffer.readInt()];
frequency = new Frequency(PacketHandler.readString(buffer), null).setPublic(buffer.readBoolean());
}
}
@@ -10,6 +10,7 @@ import mekanism.common.security.ISecurityTile.SecurityMode;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
@@ -36,7 +37,7 @@ public class PacketSecurityMode implements IMessageHandler<SecurityModeMessage,
}
}
else {
ItemStack stack = player.getCurrentEquippedItem();
ItemStack stack = player.getHeldItem(message.currentHand);
if(stack.getItem() instanceof ISecurityItem)
{
@@ -51,6 +52,7 @@ public class PacketSecurityMode implements IMessageHandler<SecurityModeMessage,
{
public SecurityPacketType packetType;
public Coord4D coord4D;
public EnumHand currentHand;
public SecurityMode value;
public SecurityModeMessage() {}
@@ -63,10 +65,11 @@ public class PacketSecurityMode implements IMessageHandler<SecurityModeMessage,
value = control;
}
public SecurityModeMessage(SecurityMode control)
public SecurityModeMessage(EnumHand hand, SecurityMode control)
{
packetType = SecurityPacketType.ITEM;
currentHand = hand;
value = control;
}
@@ -79,6 +82,9 @@ public class PacketSecurityMode implements IMessageHandler<SecurityModeMessage,
{
coord4D.write(dataStream);
}
else {
dataStream.writeInt(currentHand.ordinal());
}
dataStream.writeInt(value.ordinal());
}
@@ -92,6 +98,9 @@ public class PacketSecurityMode implements IMessageHandler<SecurityModeMessage,
{
coord4D = Coord4D.read(dataStream);
}
else {
currentHand = EnumHand.values()[dataStream.readInt()];
}
value = SecurityMode.values()[dataStream.readInt()];
}
@@ -5,6 +5,7 @@ import mekanism.common.PacketHandler;
import mekanism.common.item.ItemWalkieTalkie;
import mekanism.common.network.PacketWalkieTalkieState.WalkieTalkieStateMessage;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
@@ -14,7 +15,7 @@ public class PacketWalkieTalkieState implements IMessageHandler<WalkieTalkieStat
@Override
public IMessage onMessage(WalkieTalkieStateMessage message, MessageContext context)
{
ItemStack itemstack = PacketHandler.getPlayer(context).getCurrentEquippedItem();
ItemStack itemstack = PacketHandler.getPlayer(context).getHeldItem(message.currentHand);
if(itemstack != null && itemstack.getItem() instanceof ItemWalkieTalkie)
{
@@ -26,24 +27,29 @@ public class PacketWalkieTalkieState implements IMessageHandler<WalkieTalkieStat
public static class WalkieTalkieStateMessage implements IMessage
{
public EnumHand currentHand;
public int channel;
public WalkieTalkieStateMessage() {}
public WalkieTalkieStateMessage(int chan)
public WalkieTalkieStateMessage(EnumHand hand, int chan)
{
currentHand = hand;
channel = chan;
}
@Override
public void toBytes(ByteBuf dataStream)
{
dataStream.writeInt(currentHand.ordinal());
dataStream.writeInt(channel);
}
@Override
public void fromBytes(ByteBuf dataStream)
{
currentHand = EnumHand.values()[dataStream.readInt()];
channel = dataStream.readInt();
}
}
@@ -28,6 +28,7 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
@@ -611,16 +612,17 @@ public class TileEntityBin extends TileEntityBasicBlock implements ISidedInvento
}
@Override
public boolean onSneakRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side)
{
setActive(!getActive());
worldObj.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.UI_BUTTON_CLICK, SoundCategory.BLOCKS, 0.3F, 1);
return true;
return EnumActionResult.SUCCESS;
}
@Override
public boolean onRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onRightClick(EntityPlayer player, EnumFacing side)
{
return false;
return EnumActionResult.PASS;
}
}
@@ -35,6 +35,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.capabilities.Capability;
@@ -509,19 +510,19 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
}
@Override
public boolean onSneakRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side)
{
reset();
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.pumpReset")));
return true;
return EnumActionResult.SUCCESS;
}
@Override
public boolean onRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onRightClick(EntityPlayer player, EnumFacing side)
{
return false;
return EnumActionResult.PASS;
}
@Override
@@ -29,6 +29,7 @@ import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.common.capabilities.Capability;
@@ -448,7 +449,7 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
}
@Override
public boolean onSneakRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side)
{
if(!worldObj.isRemote)
{
@@ -456,13 +457,13 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
worldObj.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), SoundEvents.UI_BUTTON_CLICK, SoundCategory.BLOCKS, 0.3F, 1);
}
return true;
return EnumActionResult.SUCCESS;
}
@Override
public boolean onRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onRightClick(EntityPlayer player, EnumFacing side)
{
return false;
return EnumActionResult.PASS;
}
@Override
@@ -32,6 +32,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.capabilities.Capability;
@@ -487,7 +488,7 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
}
@Override
public boolean onSneakRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side)
{
activeNodes.clear();
usedNodes.clear();
@@ -495,13 +496,13 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
player.addChatMessage(new TextComponentString(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + LangUtils.localize("tooltip.configurator.plenisherReset")));
return true;
return EnumActionResult.SUCCESS;
}
@Override
public boolean onRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onRightClick(EntityPlayer player, EnumFacing side)
{
return false;
return EnumActionResult.PASS;
}
@Override
@@ -26,6 +26,7 @@ import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.MinecraftForge;
@@ -433,7 +434,7 @@ public class TileEntityInductionPort extends TileEntityInductionCasing implement
}
@Override
public boolean onSneakRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onSneakRightClick(EntityPlayer player, EnumFacing side)
{
if(!worldObj.isRemote)
{
@@ -445,13 +446,13 @@ public class TileEntityInductionPort extends TileEntityInductionCasing implement
markDirty();
}
return true;
return EnumActionResult.SUCCESS;
}
@Override
public boolean onRightClick(EntityPlayer player, EnumFacing side)
public EnumActionResult onRightClick(EntityPlayer player, EnumFacing side)
{
return false;
return EnumActionResult.PASS;
}
@Override
@@ -456,7 +456,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
if(e != null)
{
e.copyDataFromOld(entity/*, true*/);
//e.copyDataFromOld(entity/*, true*/); TODO
world.spawnEntityInWorld(e);
teleporter.didTeleport.add(e.getPersistentID());
}
@@ -47,6 +47,7 @@ import mekanism.common.base.IModule;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.ISideConfiguration;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.inventory.InventoryPersonalChest;
import mekanism.common.inventory.container.ContainerPersonalChest;
import mekanism.common.item.ItemBlockBasic;
import mekanism.common.item.ItemBlockEnergyCube;
@@ -64,9 +65,7 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -75,9 +74,7 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.Axis;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
@@ -947,7 +944,7 @@ public final class MekanismUtils
* @param inventory - IInventory of the item, if it's not a block
* @param isBlock - whether or not this electric chest is in it's block form
*/
public static void openPersonalChestGui(EntityPlayerMP player, TileEntityPersonalChest tileEntity, IInventory inventory, boolean isBlock)
public static void openPersonalChestGui(EntityPlayerMP player, TileEntityPersonalChest tileEntity, InventoryPersonalChest inventory, boolean isBlock)
{
player.getNextWindowId();
player.closeContainer();
@@ -955,10 +952,10 @@ public final class MekanismUtils
if(isBlock)
{
Mekanism.packetHandler.sendTo(new PersonalChestMessage(PersonalChestPacketType.CLIENT_OPEN, true, 0, id, Coord4D.get(tileEntity)), player);
Mekanism.packetHandler.sendTo(new PersonalChestMessage(PersonalChestPacketType.CLIENT_OPEN, true, 0, id, Coord4D.get(tileEntity), null), player);
}
else {
Mekanism.packetHandler.sendTo(new PersonalChestMessage(PersonalChestPacketType.CLIENT_OPEN, false, 0, id, null), player);
Mekanism.packetHandler.sendTo(new PersonalChestMessage(PersonalChestPacketType.CLIENT_OPEN, false, 0, id, null, inventory.currentHand), player);
}
player.openContainer = new ContainerPersonalChest(player.inventory, tileEntity, inventory, isBlock);
@@ -1,8 +1,10 @@
package mekanism.generators.common;
import static mekanism.common.MekanismBlocks.init;
import static mekanism.generators.common.block.states.BlockStateGenerator.GeneratorBlock.GENERATOR_BLOCK_1;
import static mekanism.generators.common.block.states.BlockStateReactor.ReactorBlock.REACTOR_BLOCK;
import static mekanism.generators.common.block.states.BlockStateReactor.ReactorBlock.REACTOR_GLASS;
import mekanism.common.MekanismItems;
import mekanism.generators.common.block.BlockGenerator;
import mekanism.generators.common.block.BlockReactor;
import mekanism.generators.common.block.states.BlockStateGenerator.GeneratorBlockStateMapper;
@@ -18,18 +20,22 @@ import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
@ObjectHolder("MekanismGenerators")
public class GeneratorsBlocks
{
public static final Block Generator = BlockGenerator.getGeneratorBlock(GENERATOR_BLOCK_1).setUnlocalizedName("Generator");
public static final Block Reactor = BlockReactor.getReactorBlock(REACTOR_BLOCK).setUnlocalizedName("Reactor");
public static final Block ReactorGlass = BlockReactor.getReactorBlock(REACTOR_GLASS).setUnlocalizedName("ReactorGlass");
public static final Block Generator = init(BlockGenerator.getGeneratorBlock(GENERATOR_BLOCK_1), "Generator");
public static final Block Reactor = init(BlockReactor.getReactorBlock(REACTOR_BLOCK), "Reactor");
public static final Block ReactorGlass = init(BlockReactor.getReactorBlock(REACTOR_GLASS), "ReactorGlass");
private static final IStateMapper generatorMapper = new GeneratorBlockStateMapper();
private static final IStateMapper reactorMapper = new ReactorBlockStateMapper();
public static void register()
{
GameRegistry.registerBlock(Generator, ItemBlockGenerator.class, "Generator");
GameRegistry.registerBlock(Reactor, ItemBlockReactor.class, "Reactor");
GameRegistry.registerBlock(ReactorGlass, ItemBlockReactor.class, "ReactorGlass");
GameRegistry.register(Generator);
GameRegistry.register(Reactor);
GameRegistry.register(ReactorGlass);
GameRegistry.register(MekanismItems.init(new ItemBlockGenerator(Generator), "Generator"));
GameRegistry.register(MekanismItems.init(new ItemBlockReactor(Reactor), "Reactor"));
GameRegistry.register(MekanismItems.init(new ItemBlockReactor(ReactorGlass), "ReactorGlass"));
ModelLoader.setCustomStateMapper(Generator, generatorMapper);
ModelLoader.setCustomStateMapper(Reactor, reactorMapper);
@@ -1,5 +1,6 @@
package mekanism.generators.common;
import static mekanism.common.MekanismItems.init;
import mekanism.common.item.ItemMekanism;
import mekanism.generators.common.item.ItemHohlraum;
import mekanism.generators.common.tile.turbine.TileEntityTurbineRotor;
@@ -14,15 +15,15 @@ import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
@ObjectHolder("MekanismGenerators")
public class GeneratorsItems
{
public static final Item SolarPanel = new ItemMekanism().setUnlocalizedName("SolarPanel");
public static final ItemHohlraum Hohlraum = (ItemHohlraum)new ItemHohlraum().setUnlocalizedName("Hohlraum");
public static final Item TurbineBlade = new ItemMekanism() {
public static final Item SolarPanel = init(new ItemMekanism(), "SolarPanel");
public static final ItemHohlraum Hohlraum = (ItemHohlraum)init(new ItemHohlraum(), "Hohlraum");
public static final Item TurbineBlade = init(new ItemMekanism() {
@Override
public boolean doesSneakBypassUse(ItemStack stack, IBlockAccess world, BlockPos pos, EntityPlayer player)
{
return world.getTileEntity(pos) instanceof TileEntityTurbineRotor;
}
}.setUnlocalizedName("TurbineBlade");
}, "TurbineBlade");
public static void register()
{
@@ -266,27 +266,20 @@ public abstract class BlockReactor extends BlockContainer implements ICTMBlock
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, BlockPos pos, EnumFacing side)
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{
BlockPos offsetPos = pos.offset(side.getOpposite());
int meta = state.getBlock().getMetaFromState(state);
ReactorBlockType type = ReactorBlockType.get(getReactorBlock(), meta);
if(this == GeneratorsBlocks.ReactorGlass)
if(type == ReactorBlockType.REACTOR_GLASS || type == ReactorBlockType.LASER_FOCUS_MATRIX)
{
IBlockState state = world.getBlockState(offsetPos);
int metadata = state.getBlock().getMetaFromState(state);
switch(metadata)
if(!ctmData[meta].shouldRenderSide(world, pos, side))
{
case 0:
case 1:
return ctmData[metadata].shouldRenderSide(world, pos, side);
default:
return super.shouldSideBeRendered(world, pos, side);
return false;
}
}
else {
return super.shouldSideBeRendered(world, pos, side);
}
return super.shouldSideBeRendered(state, world, pos, side);
}
@Override
@@ -57,7 +57,7 @@ public class BlockStateGenerator extends ExtendedBlockState
{
if(generatorTypeProperty == null)
{
generatorTypeProperty = PropertyEnum.create("generatorType", GeneratorType.class, new GeneratorBlockPredicate(this));
generatorTypeProperty = PropertyEnum.create("type", GeneratorType.class, new GeneratorBlockPredicate(this));
}
return generatorTypeProperty;
@@ -1,5 +1,6 @@
package mekanism.tools.common;
import mekanism.common.MekanismItems;
import mekanism.tools.item.ItemMekanismArmor;
import mekanism.tools.item.ItemMekanismAxe;
import mekanism.tools.item.ItemMekanismHoe;
@@ -96,71 +97,71 @@ public class ToolsItems
public static void initializeItems()
{
WoodPaxel = new ItemMekanismPaxel(ToolMaterial.WOOD).setUnlocalizedName("WoodPaxel");
StonePaxel = new ItemMekanismPaxel(ToolMaterial.STONE).setUnlocalizedName("StonePaxel");
IronPaxel = new ItemMekanismPaxel(ToolMaterial.IRON).setUnlocalizedName("IronPaxel");
DiamondPaxel = new ItemMekanismPaxel(ToolMaterial.DIAMOND).setUnlocalizedName("DiamondPaxel");
GoldPaxel = new ItemMekanismPaxel(ToolMaterial.GOLD).setUnlocalizedName("GoldPaxel");
GlowstonePaxel = new ItemMekanismPaxel(MekanismTools.toolGLOWSTONE2).setUnlocalizedName("GlowstonePaxel");
GlowstonePickaxe = new ItemMekanismPickaxe(MekanismTools.toolGLOWSTONE).setUnlocalizedName("GlowstonePickaxe");
GlowstoneAxe = new ItemMekanismAxe(MekanismTools.toolGLOWSTONE).setUnlocalizedName("GlowstoneAxe");
GlowstoneShovel = new ItemMekanismShovel(MekanismTools.toolGLOWSTONE).setUnlocalizedName("GlowstoneShovel");
GlowstoneHoe = new ItemMekanismHoe(MekanismTools.toolGLOWSTONE).setUnlocalizedName("GlowstoneHoe");
GlowstoneSword = new ItemMekanismSword(MekanismTools.toolGLOWSTONE).setUnlocalizedName("GlowstoneSword");
GlowstoneHelmet = new ItemMekanismArmor(MekanismTools.armorGLOWSTONE, 0).setUnlocalizedName("GlowstoneHelmet");
GlowstoneChestplate = new ItemMekanismArmor(MekanismTools.armorGLOWSTONE, 1).setUnlocalizedName("GlowstoneChestplate");
GlowstoneLeggings = new ItemMekanismArmor(MekanismTools.armorGLOWSTONE, 2).setUnlocalizedName("GlowstoneLeggings");
GlowstoneBoots = new ItemMekanismArmor(MekanismTools.armorGLOWSTONE, 3).setUnlocalizedName("GlowstoneBoots");
BronzePaxel = new ItemMekanismPaxel(MekanismTools.toolBRONZE2).setUnlocalizedName("BronzePaxel");
BronzePickaxe = new ItemMekanismPickaxe(MekanismTools.toolBRONZE).setUnlocalizedName("BronzePickaxe");
BronzeAxe = new ItemMekanismAxe(MekanismTools.toolBRONZE).setUnlocalizedName("BronzeAxe");
BronzeShovel = new ItemMekanismShovel(MekanismTools.toolBRONZE).setUnlocalizedName("BronzeShovel");
BronzeHoe = new ItemMekanismHoe(MekanismTools.toolBRONZE).setUnlocalizedName("BronzeHoe");
BronzeSword = new ItemMekanismSword(MekanismTools.toolBRONZE).setUnlocalizedName("BronzeSword");
BronzeHelmet = (new ItemMekanismArmor(MekanismTools.armorBRONZE, 0)).setUnlocalizedName("BronzeHelmet");
BronzeChestplate = (new ItemMekanismArmor(MekanismTools.armorBRONZE, 1)).setUnlocalizedName("BronzeChestplate");
BronzeLeggings = (new ItemMekanismArmor(MekanismTools.armorBRONZE, 2)).setUnlocalizedName("BronzeLeggings");
BronzeBoots = (new ItemMekanismArmor(MekanismTools.armorBRONZE, 3)).setUnlocalizedName("BronzeBoots");
OsmiumPaxel = new ItemMekanismPaxel(MekanismTools.toolOSMIUM2).setUnlocalizedName("OsmiumPaxel");
OsmiumPickaxe = new ItemMekanismPickaxe(MekanismTools.toolOSMIUM).setUnlocalizedName("OsmiumPickaxe");
OsmiumAxe = new ItemMekanismAxe(MekanismTools.toolOSMIUM).setUnlocalizedName("OsmiumAxe");
OsmiumShovel = new ItemMekanismShovel(MekanismTools.toolOSMIUM).setUnlocalizedName("OsmiumShovel");
OsmiumHoe = new ItemMekanismHoe(MekanismTools.toolOSMIUM).setUnlocalizedName("OsmiumHoe");
OsmiumSword = new ItemMekanismSword(MekanismTools.toolOSMIUM).setUnlocalizedName("OsmiumSword");
OsmiumHelmet = (new ItemMekanismArmor(MekanismTools.armorOSMIUM, 0)).setUnlocalizedName("OsmiumHelmet");
OsmiumChestplate = (new ItemMekanismArmor(MekanismTools.armorOSMIUM, 1)).setUnlocalizedName("OsmiumChestplate");
OsmiumLeggings = (new ItemMekanismArmor(MekanismTools.armorOSMIUM, 2)).setUnlocalizedName("OsmiumLeggings");
OsmiumBoots = (new ItemMekanismArmor(MekanismTools.armorOSMIUM, 3)).setUnlocalizedName("OsmiumBoots");
ObsidianPaxel = new ItemMekanismPaxel(MekanismTools.toolOBSIDIAN2).setUnlocalizedName("ObsidianPaxel");
ObsidianPickaxe = new ItemMekanismPickaxe(MekanismTools.toolOBSIDIAN).setUnlocalizedName("ObsidianPickaxe");
ObsidianAxe = new ItemMekanismAxe(MekanismTools.toolOBSIDIAN).setUnlocalizedName("ObsidianAxe");
ObsidianShovel = new ItemMekanismShovel(MekanismTools.toolOBSIDIAN).setUnlocalizedName("ObsidianShovel");
ObsidianHoe = new ItemMekanismHoe(MekanismTools.toolOBSIDIAN).setUnlocalizedName("ObsidianHoe");
ObsidianSword = new ItemMekanismSword(MekanismTools.toolOBSIDIAN).setUnlocalizedName("ObsidianSword");
ObsidianHelmet = (new ItemMekanismArmor(MekanismTools.armorOBSIDIAN, 0)).setUnlocalizedName("ObsidianHelmet");
ObsidianChestplate = (new ItemMekanismArmor(MekanismTools.armorOBSIDIAN, 1)).setUnlocalizedName("ObsidianChestplate");
ObsidianLeggings = (new ItemMekanismArmor(MekanismTools.armorOBSIDIAN, 2)).setUnlocalizedName("ObsidianLeggings");
ObsidianBoots = (new ItemMekanismArmor(MekanismTools.armorOBSIDIAN, 3)).setUnlocalizedName("ObsidianBoots");
LazuliPaxel = new ItemMekanismPaxel(MekanismTools.toolLAZULI2).setUnlocalizedName("LazuliPaxel");
LazuliPickaxe = new ItemMekanismPickaxe(MekanismTools.toolLAZULI).setUnlocalizedName("LazuliPickaxe");
LazuliAxe = new ItemMekanismAxe(MekanismTools.toolLAZULI).setUnlocalizedName("LazuliAxe");
LazuliShovel = new ItemMekanismShovel(MekanismTools.toolLAZULI).setUnlocalizedName("LazuliShovel");
LazuliHoe = new ItemMekanismHoe(MekanismTools.toolLAZULI).setUnlocalizedName("LazuliHoe");
LazuliSword = new ItemMekanismSword(MekanismTools.toolLAZULI).setUnlocalizedName("LazuliSword");
LazuliHelmet = (new ItemMekanismArmor(MekanismTools.armorLAZULI, 0)).setUnlocalizedName("LazuliHelmet");
LazuliChestplate = (new ItemMekanismArmor(MekanismTools.armorLAZULI, 1)).setUnlocalizedName("LazuliChestplate");
LazuliLeggings = (new ItemMekanismArmor(MekanismTools.armorLAZULI, 2)).setUnlocalizedName("LazuliLeggings");
LazuliBoots = (new ItemMekanismArmor(MekanismTools.armorLAZULI, 3)).setUnlocalizedName("LazuliBoots");
SteelPaxel = new ItemMekanismPaxel(MekanismTools.toolSTEEL2).setUnlocalizedName("SteelPaxel");
SteelPickaxe = new ItemMekanismPickaxe(MekanismTools.toolSTEEL).setUnlocalizedName("SteelPickaxe");
SteelAxe = new ItemMekanismAxe(MekanismTools.toolSTEEL).setUnlocalizedName("SteelAxe");
SteelShovel = new ItemMekanismShovel(MekanismTools.toolSTEEL).setUnlocalizedName("SteelShovel");
SteelHoe = new ItemMekanismHoe(MekanismTools.toolSTEEL).setUnlocalizedName("SteelHoe");
SteelSword = new ItemMekanismSword(MekanismTools.toolSTEEL).setUnlocalizedName("SteelSword");
SteelHelmet = new ItemMekanismArmor(MekanismTools.armorSTEEL, 0).setUnlocalizedName("SteelHelmet");
SteelChestplate = new ItemMekanismArmor(MekanismTools.armorSTEEL, 1).setUnlocalizedName("SteelChestplate");
SteelLeggings = new ItemMekanismArmor(MekanismTools.armorSTEEL, 2).setUnlocalizedName("SteelLeggings");
SteelBoots = new ItemMekanismArmor(MekanismTools.armorSTEEL, 3).setUnlocalizedName("SteelBoots");
WoodPaxel = MekanismItems.init(new ItemMekanismPaxel(ToolMaterial.WOOD), "WoodPaxel");
StonePaxel = MekanismItems.init(new ItemMekanismPaxel(ToolMaterial.STONE), "StonePaxel");
IronPaxel = MekanismItems.init(new ItemMekanismPaxel(ToolMaterial.IRON), "IronPaxel");
DiamondPaxel = MekanismItems.init(new ItemMekanismPaxel(ToolMaterial.DIAMOND), "DiamondPaxel");
GoldPaxel = MekanismItems.init(new ItemMekanismPaxel(ToolMaterial.GOLD), "GoldPaxel");
GlowstonePaxel = MekanismItems.init(new ItemMekanismPaxel(MekanismTools.toolGLOWSTONE2), "GlowstonePaxel");
GlowstonePickaxe = MekanismItems.init(new ItemMekanismPickaxe(MekanismTools.toolGLOWSTONE), "GlowstonePickaxe");
GlowstoneAxe = MekanismItems.init(new ItemMekanismAxe(MekanismTools.toolGLOWSTONE), "GlowstoneAxe");
GlowstoneShovel = MekanismItems.init(new ItemMekanismShovel(MekanismTools.toolGLOWSTONE), "GlowstoneShovel");
GlowstoneHoe = MekanismItems.init(new ItemMekanismHoe(MekanismTools.toolGLOWSTONE), "GlowstoneHoe");
GlowstoneSword = MekanismItems.init(new ItemMekanismSword(MekanismTools.toolGLOWSTONE), "GlowstoneSword");
GlowstoneHelmet = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorGLOWSTONE, 0), "GlowstoneHelmet");
GlowstoneChestplate = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorGLOWSTONE, 1), "GlowstoneChestplate");
GlowstoneLeggings = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorGLOWSTONE, 2), "GlowstoneLeggings");
GlowstoneBoots = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorGLOWSTONE, 3), "GlowstoneBoots");
BronzePaxel = MekanismItems.init(new ItemMekanismPaxel(MekanismTools.toolBRONZE2), "BronzePaxel");
BronzePickaxe = MekanismItems.init(new ItemMekanismPickaxe(MekanismTools.toolBRONZE), "BronzePickaxe");
BronzeAxe = MekanismItems.init(new ItemMekanismAxe(MekanismTools.toolBRONZE), "BronzeAxe");
BronzeShovel = MekanismItems.init(new ItemMekanismShovel(MekanismTools.toolBRONZE), "BronzeShovel");
BronzeHoe = MekanismItems.init(new ItemMekanismHoe(MekanismTools.toolBRONZE), "BronzeHoe");
BronzeSword = MekanismItems.init(new ItemMekanismSword(MekanismTools.toolBRONZE), "BronzeSword");
BronzeHelmet = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorBRONZE, 0), "BronzeHelmet");
BronzeChestplate = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorBRONZE, 1), "BronzeChestplate");
BronzeLeggings = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorBRONZE, 2), "BronzeLeggings");
BronzeBoots = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorBRONZE, 3), "BronzeBoots");
OsmiumPaxel = MekanismItems.init(new ItemMekanismPaxel(MekanismTools.toolOSMIUM2), "OsmiumPaxel");
OsmiumPickaxe = MekanismItems.init(new ItemMekanismPickaxe(MekanismTools.toolOSMIUM), "OsmiumPickaxe");
OsmiumAxe = MekanismItems.init(new ItemMekanismAxe(MekanismTools.toolOSMIUM), "OsmiumAxe");
OsmiumShovel = MekanismItems.init(new ItemMekanismShovel(MekanismTools.toolOSMIUM), "OsmiumShovel");
OsmiumHoe = MekanismItems.init(new ItemMekanismHoe(MekanismTools.toolOSMIUM), "OsmiumHoe");
OsmiumSword = MekanismItems.init(new ItemMekanismSword(MekanismTools.toolOSMIUM), "OsmiumSword");
OsmiumHelmet = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorOSMIUM, 0), "OsmiumHelmet");
OsmiumChestplate = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorOSMIUM, 1), "OsmiumChestplate");
OsmiumLeggings = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorOSMIUM, 2), "OsmiumLeggings");
OsmiumBoots = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorOSMIUM, 3), "OsmiumBoots");
ObsidianPaxel = MekanismItems.init(new ItemMekanismPaxel(MekanismTools.toolOBSIDIAN2), "ObsidianPaxel");
ObsidianPickaxe = MekanismItems.init(new ItemMekanismPickaxe(MekanismTools.toolOBSIDIAN), "ObsidianPickaxe");
ObsidianAxe = MekanismItems.init(new ItemMekanismAxe(MekanismTools.toolOBSIDIAN), "ObsidianAxe");
ObsidianShovel = MekanismItems.init(new ItemMekanismShovel(MekanismTools.toolOBSIDIAN), "ObsidianShovel");
ObsidianHoe = MekanismItems.init(new ItemMekanismHoe(MekanismTools.toolOBSIDIAN), "ObsidianHoe");
ObsidianSword = MekanismItems.init(new ItemMekanismSword(MekanismTools.toolOBSIDIAN), "ObsidianSword");
ObsidianHelmet = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorOBSIDIAN, 0), "ObsidianHelmet");
ObsidianChestplate = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorOBSIDIAN, 1), "ObsidianChestplate");
ObsidianLeggings = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorOBSIDIAN, 2), "ObsidianLeggings");
ObsidianBoots = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorOBSIDIAN, 3), "ObsidianBoots");
LazuliPaxel = MekanismItems.init(new ItemMekanismPaxel(MekanismTools.toolLAZULI2), "LazuliPaxel");
LazuliPickaxe = MekanismItems.init(new ItemMekanismPickaxe(MekanismTools.toolLAZULI), "LazuliPickaxe");
LazuliAxe = MekanismItems.init(new ItemMekanismAxe(MekanismTools.toolLAZULI), "LazuliAxe");
LazuliShovel = MekanismItems.init(new ItemMekanismShovel(MekanismTools.toolLAZULI), "LazuliShovel");
LazuliHoe = MekanismItems.init(new ItemMekanismHoe(MekanismTools.toolLAZULI), "LazuliHoe");
LazuliSword = MekanismItems.init(new ItemMekanismSword(MekanismTools.toolLAZULI), "LazuliSword");
LazuliHelmet = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorLAZULI, 0), "LazuliHelmet");
LazuliChestplate = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorLAZULI, 1), "LazuliChestplate");
LazuliLeggings = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorLAZULI, 2), "LazuliLeggings");
LazuliBoots = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorLAZULI, 3), "LazuliBoots");
SteelPaxel = MekanismItems.init(new ItemMekanismPaxel(MekanismTools.toolSTEEL2), "SteelPaxel");
SteelPickaxe = MekanismItems.init(new ItemMekanismPickaxe(MekanismTools.toolSTEEL), "SteelPickaxe");
SteelAxe = MekanismItems.init(new ItemMekanismAxe(MekanismTools.toolSTEEL), "SteelAxe");
SteelShovel = MekanismItems.init(new ItemMekanismShovel(MekanismTools.toolSTEEL), "SteelShovel");
SteelHoe = MekanismItems.init(new ItemMekanismHoe(MekanismTools.toolSTEEL), "SteelHoe");
SteelSword = MekanismItems.init(new ItemMekanismSword(MekanismTools.toolSTEEL), "SteelSword");
SteelHelmet = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorSTEEL, 0), "SteelHelmet");
SteelChestplate = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorSTEEL, 1), "SteelChestplate");
SteelLeggings = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorSTEEL, 2), "SteelLeggings");
SteelBoots = MekanismItems.init(new ItemMekanismArmor(MekanismTools.armorSTEEL, 3), "SteelBoots");
}
public static void setHarvestLevels()