mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 23:33:08 +00:00
No more errors, the game launches, rejoice!
This commit is contained in:
1 parent
79af86daae
commit
ceec3e71e9
67 files changed
+951
-676
No files matched your search
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user