mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Fix item package
This commit is contained in:
1 parent
591fc1e4b4
commit
8af7ec270a
53 files changed
+309
-397
No files matched your search
@@ -144,6 +144,12 @@ public class Coord4D extends BlockPos
|
||||
return world.getBlockState(this).getBlock();
|
||||
}
|
||||
|
||||
public int getBlockMeta(IBlockAccess world)
|
||||
{
|
||||
IBlockState state = getBlockState(world);
|
||||
return state == null ? 0 : state.getBlock().getMetaFromState(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes this Coord4D's data to an NBTTagCompound.
|
||||
* @param nbtTags - tag compound to write to
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mekanism.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Implement this in your TileEntity class if your block can be modified by a Configurator.
|
||||
@@ -15,7 +16,7 @@ public interface IConfigurable
|
||||
* @param side - the side the block was clicked on
|
||||
* @return whether or not an action was performed
|
||||
*/
|
||||
public boolean onSneakRightClick(EntityPlayer player, int side);
|
||||
public boolean onSneakRightClick(EntityPlayer player, EnumFacing side);
|
||||
|
||||
/**
|
||||
* Called when a player right clicks this block with a Configurator.
|
||||
@@ -23,5 +24,5 @@ public interface IConfigurable
|
||||
* @param side - the side the block was clicked on
|
||||
* @return whether or not an action was performed
|
||||
*/
|
||||
public boolean onRightClick(EntityPlayer player, int side);
|
||||
public boolean onRightClick(EntityPlayer player, EnumFacing side);
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
package mekanism.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
public interface IMekWrench
|
||||
{
|
||||
public boolean canUseWrench(EntityPlayer player, int x, int y, int z);
|
||||
public boolean canUseWrench(EntityPlayer player, BlockPos pos);
|
||||
}
|
||||
@@ -6,9 +6,7 @@ import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
|
||||
public class GuiEnergyGauge extends GuiGauge
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ public interface ISoundSource
|
||||
public float getVolume();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getPitch();
|
||||
public float getFrequency();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Pos3D getSoundPosition();
|
||||
|
||||
@@ -148,7 +148,7 @@ public class Sound implements ISound
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPitch()
|
||||
public float getFrequency()
|
||||
{
|
||||
return pitch;
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ public class TileSound extends Sound implements IResettableSound
|
||||
|
||||
public TileSound(IHasSound source, ISoundSource values)
|
||||
{
|
||||
this(source, values.getSoundLocation(), values.getVolume(), values.getPitch(), values.shouldRepeat(), values.getRepeatDelay(), values.getSoundPosition().xCoord, values.getSoundPosition().yCoord, values.getSoundPosition().zCoord);
|
||||
this(source, values.getSoundLocation(), values.getVolume(), values.getFrequency(), values.shouldRepeat(), values.getRepeatDelay(), values.getSoundPosition().xCoord, values.getSoundPosition().yCoord, values.getSoundPosition().zCoord);
|
||||
}
|
||||
|
||||
public TileSound(IHasSound source, ISoundSource values, ResourceLocation location)
|
||||
{
|
||||
this(source, location, values.getVolume(), values.getPitch(), values.shouldRepeat(), values.getRepeatDelay(), values.getSoundPosition().xCoord, values.getSoundPosition().yCoord, values.getSoundPosition().zCoord);
|
||||
this(source, location, values.getVolume(), values.getFrequency(), values.shouldRepeat(), values.getRepeatDelay(), values.getSoundPosition().xCoord, values.getSoundPosition().yCoord, values.getSoundPosition().zCoord);
|
||||
}
|
||||
|
||||
public TileSound(IHasSound source, String sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z)
|
||||
|
||||
@@ -73,6 +73,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
@@ -204,74 +205,32 @@ public class PacketHandler
|
||||
|
||||
public static void writeString(ByteBuf output, String s)
|
||||
{
|
||||
output.writeInt(s.getBytes().length);
|
||||
output.writeBytes(s.getBytes());
|
||||
ByteBufUtils.writeUTF8String(output, s);
|
||||
}
|
||||
|
||||
public static String readString(ByteBuf input)
|
||||
{
|
||||
return new String(input.readBytes(input.readInt()).array());
|
||||
return ByteBufUtils.readUTF8String(input);
|
||||
}
|
||||
|
||||
public static void writeStack(ByteBuf output, ItemStack stack)
|
||||
{
|
||||
output.writeInt(stack != null ? Item.getIdFromItem(stack.getItem()) : -1);
|
||||
|
||||
if(stack != null)
|
||||
{
|
||||
output.writeInt(stack.stackSize);
|
||||
output.writeInt(stack.getItemDamage());
|
||||
|
||||
if(stack.getTagCompound() != null && stack.getItem().getShareTag())
|
||||
{
|
||||
output.writeBoolean(true);
|
||||
writeNBT(output, stack.getTagCompound());
|
||||
}
|
||||
else {
|
||||
output.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
ByteBufUtils.writeItemStack(output, stack);
|
||||
}
|
||||
|
||||
public static ItemStack readStack(ByteBuf input)
|
||||
{
|
||||
int id = input.readInt();
|
||||
|
||||
if(id >= 0)
|
||||
{
|
||||
ItemStack stack = new ItemStack(Item.getItemById(id), input.readInt(), input.readInt());
|
||||
|
||||
if(input.readBoolean())
|
||||
{
|
||||
stack.setTagCompound(readNBT(input));
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
return null;
|
||||
return ByteBufUtils.readItemStack(input);
|
||||
}
|
||||
|
||||
public static void writeNBT(ByteBuf output, NBTTagCompound nbtTags)
|
||||
{
|
||||
try {
|
||||
byte[] buffer = CompressedStreamTools.compress(nbtTags);
|
||||
|
||||
output.writeInt(buffer.length);
|
||||
output.writeBytes(buffer);
|
||||
} catch(Exception e) {}
|
||||
ByteBufUtils.writeTag(output, nbtTags);
|
||||
}
|
||||
|
||||
public static NBTTagCompound readNBT(ByteBuf input)
|
||||
{
|
||||
try {
|
||||
byte[] buffer = new byte[input.readInt()];
|
||||
input.readBytes(buffer);
|
||||
|
||||
return CompressedStreamTools.decompress(buffer, new NBTSizeTracker(2097152L));
|
||||
} catch(Exception e) {
|
||||
return null;
|
||||
}
|
||||
return ByteBufUtils.readTag(input);
|
||||
}
|
||||
|
||||
public static void log(String log)
|
||||
|
||||
@@ -355,10 +355,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData
|
||||
{
|
||||
data.writeByte((byte)1);
|
||||
|
||||
data.writeInt(latched.getX());
|
||||
data.writeInt(latched.getY());
|
||||
data.writeInt(latched.getZ());
|
||||
data.writeInt(latched.dimensionId);
|
||||
latched.write(data);
|
||||
}
|
||||
else if(latchedEntity != null)
|
||||
{
|
||||
|
||||
@@ -13,12 +13,13 @@ import mekanism.api.util.ListUtils;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
@@ -36,9 +37,6 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
super(1000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(Block block, ItemStack stack)
|
||||
{
|
||||
@@ -46,7 +44,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
super.addInformation(itemstack, entityplayer, list, flag);
|
||||
|
||||
@@ -70,15 +68,15 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack itemstack, Block block, int meta)
|
||||
public float getDigSpeed(ItemStack itemstack, IBlockState state)
|
||||
{
|
||||
return getEnergy(itemstack) != 0 ? getEfficiency(itemstack) : 1F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase entityliving)
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, BlockPos pos, EntityLivingBase entityliving)
|
||||
{
|
||||
if(block.getBlockHardness(world, x, y, z) != 0.0D)
|
||||
if(block.getBlockHardness(world, pos) != 0.0D)
|
||||
{
|
||||
setEnergy(itemstack, getEnergy(itemstack) - (general.DISASSEMBLER_USAGE*getEfficiency(itemstack)));
|
||||
}
|
||||
@@ -90,22 +88,23 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player)
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
super.onBlockStartBreak(itemstack, x, y, z, player);
|
||||
super.onBlockStartBreak(itemstack, pos, player);
|
||||
|
||||
if(!player.worldObj.isRemote)
|
||||
{
|
||||
Block block = player.worldObj.getBlock(x, y, z);
|
||||
int meta = player.worldObj.getBlockMetadata(x, y, z);
|
||||
|
||||
IBlockState state = player.worldObj.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
int meta = block.getMetaFromState(state);
|
||||
|
||||
if(block == Blocks.lit_redstone_ore)
|
||||
{
|
||||
block = Blocks.redstone_ore;
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(block, 1, meta);
|
||||
Coord4D orig = new Coord4D(x, y, z, player.worldObj.provider.getDimensionId());
|
||||
Coord4D orig = new Coord4D(pos, player.worldObj.provider.getDimensionId());
|
||||
|
||||
List<String> names = MekanismUtils.getOreDictName(stack);
|
||||
|
||||
@@ -121,7 +120,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
|
||||
if(getMode(itemstack) == 3 && isOre && !player.capabilities.isCreativeMode)
|
||||
{
|
||||
Set<Coord4D> found = new Finder(player.worldObj, stack, new Coord4D(x, y, z, player.worldObj.provider.getDimensionId())).calc();
|
||||
Set<Coord4D> found = new Finder(player.worldObj, stack, new Coord4D(pos, player.worldObj.provider.getDimensionId())).calc();
|
||||
|
||||
for(Coord4D coord : found)
|
||||
{
|
||||
@@ -132,11 +131,11 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
|
||||
Block block2 = coord.getBlock(player.worldObj);
|
||||
|
||||
block2.onBlockDestroyedByPlayer(player.worldObj, coord.xCoord, coord.yCoord, coord.zCoord, meta);
|
||||
player.worldObj.playAuxSFXAtEntity(null, 2001, coord.xCoord, coord.yCoord, coord.zCoord, meta << 12);
|
||||
player.worldObj.setBlockToAir(coord.xCoord, coord.yCoord, coord.zCoord);
|
||||
block2.breakBlock(player.worldObj, coord.xCoord, coord.yCoord, coord.zCoord, block, meta);
|
||||
block2.dropBlockAsItem(player.worldObj, coord.xCoord, coord.yCoord, coord.zCoord, meta, 0);
|
||||
block2.onBlockDestroyedByPlayer(player.worldObj, coord, state);
|
||||
player.worldObj.playAuxSFXAtEntity(null, 2001, coord, meta << 12);
|
||||
player.worldObj.setBlockToAir(coord);
|
||||
block2.breakBlock(player.worldObj, coord, state);
|
||||
block2.dropBlockAsItem(player.worldObj, coord, state, 0);
|
||||
|
||||
setEnergy(itemstack, getEnergy(itemstack) - (general.DISASSEMBLER_USAGE*getEfficiency(itemstack)));
|
||||
}
|
||||
@@ -165,13 +164,13 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!player.isSneaking())
|
||||
{
|
||||
if(!useHoe(stack, player, world, x, y, z, side))
|
||||
if(!useHoe(stack, player, world, pos, side))
|
||||
{
|
||||
if(world.getBlock(x, y, z) != Blocks.farmland)
|
||||
if(world.getBlockState(pos).getBlock() != Blocks.farmland)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -180,21 +179,21 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
switch(getEfficiency(stack))
|
||||
{
|
||||
case 20:
|
||||
for(int x1 = x-1; x1 <= x+1; x1++)
|
||||
for(int x1 = -1; x1 <= +1; x1++)
|
||||
{
|
||||
for(int z1 = z-1; z1 <= z+1; z1++)
|
||||
for(int z1 = -1; z1 <= +1; z1++)
|
||||
{
|
||||
useHoe(stack, player, world, x1, y, z1, side);
|
||||
useHoe(stack, player, world, pos.add(x1, 0, z1), side);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 128:
|
||||
for(int x1 = x-2; x1 <= x+2; x1++)
|
||||
for(int x1 = -2; x1 <= +2; x1++)
|
||||
{
|
||||
for(int z1 = z-2; z1 <= z+2; z1++)
|
||||
for(int z1 = -2; z1 <= +2; z1++)
|
||||
{
|
||||
useHoe(stack, player, world, x1, y, z1, side);
|
||||
useHoe(stack, player, world, pos.add(x1, 0, z1), side);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,14 +206,14 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean useHoe(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side)
|
||||
private boolean useHoe(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
if(!player.canPlayerEdit(x, y, z, side, stack) || (!player.capabilities.isCreativeMode && getEnergy(stack) < HOE_USAGE))
|
||||
if(!player.canPlayerEdit(pos, side, stack) || (!player.capabilities.isCreativeMode && getEnergy(stack) < HOE_USAGE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
UseHoeEvent event = new UseHoeEvent(player, stack, world, x, y, z);
|
||||
UseHoeEvent event = new UseHoeEvent(player, stack, world, pos);
|
||||
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
@@ -227,20 +226,20 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
return true;
|
||||
}
|
||||
|
||||
Block block1 = world.getBlock(x, y, z);
|
||||
boolean air = world.isAirBlock(x, y + 1, z);
|
||||
Block block1 = world.getBlockState(pos).getBlock();
|
||||
boolean air = block1.isAir(world, pos.up());
|
||||
|
||||
if(side != 0 && air && (block1 == Blocks.grass || block1 == Blocks.dirt))
|
||||
if(side != EnumFacing.DOWN && air && (block1 == Blocks.grass || block1 == Blocks.dirt))
|
||||
{
|
||||
Block farm = Blocks.farmland;
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, farm.stepSound.getStepResourcePath(), (farm.stepSound.getVolume() + 1.0F) / 2.0F, farm.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, farm.stepSound.getStepSound(), (farm.stepSound.getVolume() + 1.0F) / 2.0F, farm.stepSound.getFrequency() * 0.8F);
|
||||
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
world.setBlock(x, y, z, farm);
|
||||
world.setBlockState(pos, farm.getDefaultState());
|
||||
|
||||
if(!player.capabilities.isCreativeMode)
|
||||
{
|
||||
@@ -354,7 +353,7 @@ public class ItemAtomicDisassembler extends ItemEnergized
|
||||
{
|
||||
Coord4D coord = pointer.offset(side);
|
||||
|
||||
if(coord.exists(world) && checkID(coord.getBlock(world)) && (coord.getBlockState(world) == stack.getItemDamage() || (MekanismUtils.getOreDictName(stack).contains("logWood") && coord.getBlockState(world) % 4 == stack.getItemDamage() % 4)))
|
||||
if(coord.exists(world) && checkID(coord.getBlock(world)) && (coord.getBlockMeta(world) == stack.getItemDamage() || (MekanismUtils.getOreDictName(stack).contains("logWood") && coord.getBlockMeta(world) % 4 == stack.getItemDamage() % 4)))
|
||||
{
|
||||
loop(coord);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.Pos3D;
|
||||
import mekanism.common.entity.EntityBalloon;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
@@ -17,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -38,7 +36,7 @@ public class ItemBalloon extends ItemMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> list)
|
||||
{
|
||||
for(int i = 0; i < EnumColor.DYES.length; i++)
|
||||
{
|
||||
@@ -58,13 +56,9 @@ public class ItemBalloon extends ItemMekanism
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
Pos3D pos = new Pos3D();
|
||||
pos.zPos += 0.3;
|
||||
pos.xPos -= 0.4;
|
||||
pos.rotateYaw(entityplayer.renderYawOffset);
|
||||
pos.translate(new Pos3D(entityplayer));
|
||||
Pos3D pos = new Pos3D(-0.4, 0, 0.3).rotateYaw(entityplayer.renderYawOffset).translate(new Pos3D(entityplayer));
|
||||
|
||||
world.spawnEntityInWorld(new EntityBalloon(world, pos.xPos-0.5, pos.yPos-0.25, pos.zPos-0.5, getColor(itemstack)));
|
||||
world.spawnEntityInWorld(new EntityBalloon(world, pos.xCoord-0.5, pos.yCoord-0.25, pos.zCoord-0.5, getColor(itemstack)));
|
||||
}
|
||||
|
||||
itemstack.stackSize--;
|
||||
@@ -92,11 +86,11 @@ public class ItemBalloon extends ItemMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(player.isSneaking())
|
||||
{
|
||||
AxisAlignedBB bound = AxisAlignedBB.getBoundingBox(x, y, z, x+1, y+3, z+1);
|
||||
AxisAlignedBB bound = new AxisAlignedBB(pos, pos.add(1, 3, 1));
|
||||
|
||||
List<EntityBalloon> balloonsNear = player.worldObj.getEntitiesWithinAABB(EntityBalloon.class, bound);
|
||||
|
||||
@@ -105,26 +99,24 @@ public class ItemBalloon extends ItemMekanism
|
||||
return true;
|
||||
}
|
||||
|
||||
Coord4D obj = new Coord4D(x, y, z, world.provider.getDimensionId());
|
||||
|
||||
if(obj.getBlock(world).isReplaceable(world, x, y, z))
|
||||
if(world.getBlockState(pos).getBlock().isReplaceable(world, pos))
|
||||
{
|
||||
obj.yCoord--;
|
||||
pos = pos.down();
|
||||
}
|
||||
|
||||
if(!world.isSideSolid(x, y, z, EnumFacing.UP))
|
||||
if(!world.isSideSolid(pos, EnumFacing.UP))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(canReplace(world, obj.xCoord, obj.yCoord+1, obj.zCoord) && canReplace(world, obj.xCoord, obj.yCoord+2, obj.zCoord))
|
||||
if(canReplace(world, pos.up()) && canReplace(world, pos.up(2)))
|
||||
{
|
||||
world.setBlockToAir(obj.xCoord, obj.yCoord+1, obj.zCoord);
|
||||
world.setBlockToAir(obj.xCoord, obj.yCoord+2, obj.zCoord);
|
||||
world.setBlockToAir(pos.up());
|
||||
world.setBlockToAir(pos.up(2));
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityBalloon(world, obj, getColor(stack)));
|
||||
world.spawnEntityInWorld(new EntityBalloon(world, new Coord4D(pos, world.provider.getDimensionId()), getColor(stack)));
|
||||
stack.stackSize--;
|
||||
}
|
||||
}
|
||||
@@ -142,7 +134,7 @@ public class ItemBalloon extends ItemMekanism
|
||||
{
|
||||
if(!player.worldObj.isRemote)
|
||||
{
|
||||
AxisAlignedBB bound = AxisAlignedBB.getBoundingBox(entity.posX - 0.2, entity.posY - 0.5, entity.posZ - 0.2, entity.posX + 0.2, entity.posY + entity.ySize + 4, entity.posZ + 0.2);
|
||||
AxisAlignedBB bound = new AxisAlignedBB(entity.posX - 0.2, entity.posY - 0.5, entity.posZ - 0.2, entity.posX + 0.2, entity.posY + entity.height + 4, entity.posZ + 0.2);
|
||||
|
||||
List<EntityBalloon> balloonsNear = player.worldObj.getEntitiesWithinAABB(EntityBalloon.class, bound);
|
||||
|
||||
@@ -164,29 +156,25 @@ public class ItemBalloon extends ItemMekanism
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canReplace(World world, int x, int y, int z)
|
||||
private boolean canReplace(World world, BlockPos pos)
|
||||
{
|
||||
return world.isAirBlock(x, y, z) || world.getBlock(x, y, z).isReplaceable(world, x, y, z);
|
||||
return world.isAirBlock(pos) || world.getBlockState(pos).getBlock().isReplaceable(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {}
|
||||
|
||||
public class DispenserBehavior extends BehaviorDefaultDispenseItem
|
||||
{
|
||||
@Override
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
|
||||
{
|
||||
Coord4D coord = new Coord4D(source.getXInt(), source.getYInt(), source.getZInt(), source.getWorld().provider.getDimensionId());
|
||||
EnumFacing side = EnumFacing.getFront(BlockDispenser.func_149937_b(source.getBlockMetadata()).ordinal());
|
||||
Coord4D coord = new Coord4D(source.getX(), source.getY(), source.getZ(), source.getWorld().provider.getDimensionId());
|
||||
EnumFacing side = EnumFacing.getFront(BlockDispenser.getFacing(source.getBlockMetadata()).ordinal());
|
||||
|
||||
List<EntityLivingBase> entities = source.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, coord.offset(side).getBoundingBox());
|
||||
boolean latched = false;
|
||||
|
||||
for(EntityLivingBase entity : entities)
|
||||
{
|
||||
AxisAlignedBB bound = AxisAlignedBB.getBoundingBox(entity.posX - 0.2, entity.posY - 0.5, entity.posZ - 0.2, entity.posX + 0.2, entity.posY + entity.ySize + 4, entity.posZ + 0.2);
|
||||
AxisAlignedBB bound = new AxisAlignedBB(entity.posX - 0.2, entity.posY - 0.5, entity.posZ - 0.2, entity.posX + 0.2, entity.posY + entity.height + 4, entity.posZ + 0.2);
|
||||
|
||||
List<EntityBalloon> balloonsNear = source.getWorld().getEntitiesWithinAABB(EntityBalloon.class, bound);
|
||||
boolean hasBalloon = false;
|
||||
@@ -236,7 +224,7 @@ public class ItemBalloon extends ItemMekanism
|
||||
|
||||
if(!source.getWorld().isRemote)
|
||||
{
|
||||
source.getWorld().spawnEntityInWorld(new EntityBalloon(source.getWorld(), pos.xPos, pos.yPos, pos.zPos, getColor(stack)));
|
||||
source.getWorld().spawnEntityInWorld(new EntityBalloon(source.getWorld(), new Coord4D(new BlockPos(pos)), getColor(stack)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,15 @@ import mekanism.common.tile.TileEntityMultiblock;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -121,14 +124,14 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int i)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
return metaBlock.getIcon(2, i);
|
||||
return null; //TODO: IDONTKNOWHOWTODOTHIS
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
if(Block.getBlockFromItem(this) == MekanismBlocks.BasicBlock && itemstack.getItemDamage() == 6)
|
||||
{
|
||||
@@ -171,6 +174,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
return stack.getItemDamage() == 6 && stack.getTagCompound() != null && stack.getTagCompound().hasKey("newCount");
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack)
|
||||
{
|
||||
@@ -189,6 +193,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack stack)
|
||||
@@ -210,9 +215,9 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState metadata)
|
||||
{
|
||||
boolean place = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
|
||||
boolean place = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, metadata);
|
||||
|
||||
if(place)
|
||||
{
|
||||
@@ -220,7 +225,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
{
|
||||
if(stack.getItemDamage() == 6 && stack.getTagCompound() != null)
|
||||
{
|
||||
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(x, y, z);
|
||||
TileEntityBin tileEntity = (TileEntityBin)world.getTileEntity(pos);
|
||||
InventoryBin inv = new InventoryBin(stack);
|
||||
|
||||
if(inv.getItemType() != null)
|
||||
@@ -235,7 +240,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
{
|
||||
if(stack.getItemDamage() == 3)
|
||||
{
|
||||
TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionCell tileEntity = (TileEntityInductionCell)world.getTileEntity(pos);
|
||||
tileEntity.tier = InductionCellTier.values()[getTier(stack).ordinal()];
|
||||
|
||||
if(!world.isRemote)
|
||||
@@ -245,7 +250,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
}
|
||||
else if(stack.getItemDamage() == 4)
|
||||
{
|
||||
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(x, y, z);
|
||||
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(pos);
|
||||
tileEntity.tier = InductionProviderTier.values()[getTier(stack).ordinal()];
|
||||
|
||||
if(!world.isRemote)
|
||||
@@ -255,7 +260,7 @@ public class ItemBlockBasic extends ItemBlock implements IEnergizedItem
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof IStrictEnergyStorage && !(tileEntity instanceof TileEntityMultiblock<?>))
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ import mekanism.common.block.BlockCardboardBox.BlockData;
|
||||
import mekanism.common.tile.TileEntityCardboardBox;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -16,7 +17,8 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
@@ -41,7 +43,7 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
list.add(EnumColor.INDIGO + LangUtils.localize("tooltip.blockData") + ": " + LangUtils.transYesNo(getBlockData(itemstack) != null));
|
||||
|
||||
@@ -64,20 +66,15 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int i)
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return metaBlock.getIcon(2, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!player.isSneaking() && !world.isAirBlock(x, y, z) && stack.getItemDamage() == 0)
|
||||
if(!player.isSneaking() && !world.isAirBlock(pos) && stack.getItemDamage() == 0)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
int meta = block.getMetaFromState(state);
|
||||
|
||||
if(!world.isRemote && MekanismAPI.isBlockCompatible(Item.getItemFromBlock(block), meta) && block.getBlockHardness(world, x, y, z) != -1)
|
||||
if(!world.isRemote && MekanismAPI.isBlockCompatible(Item.getItemFromBlock(block), meta) && block.getBlockHardness(world, pos) != -1)
|
||||
{
|
||||
BlockData data = new BlockData();
|
||||
data.block = block;
|
||||
@@ -85,9 +82,9 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||
|
||||
isMonitoring = true;
|
||||
|
||||
if(world.getTileEntity(x, y, z) != null)
|
||||
if(world.getTileEntity(pos) != null)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
||||
tile.writeToNBT(tag);
|
||||
@@ -99,11 +96,11 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||
stack.stackSize--;
|
||||
}
|
||||
|
||||
world.setBlock(x, y, z, MekanismBlocks.CardboardBox, 1, 3);
|
||||
world.setBlockState(pos, MekanismBlocks.CardboardBox.getStateFromMeta(1), 3);
|
||||
|
||||
isMonitoring = false;
|
||||
|
||||
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(x, y, z);
|
||||
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity != null)
|
||||
{
|
||||
@@ -118,18 +115,18 @@ public class ItemBlockCardboardBox extends ItemBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState state)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean place = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
|
||||
boolean place = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, state);
|
||||
|
||||
if(place)
|
||||
{
|
||||
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(x, y, z);
|
||||
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity != null)
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ import mekanism.common.tile.TileEntityEnergyCube;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -30,6 +31,8 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
@@ -59,7 +62,7 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey))
|
||||
{
|
||||
@@ -86,13 +89,13 @@ public class ItemBlockEnergyCube extends ItemBlock implements IEnergizedItem, IE
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState state)
|
||||
{
|
||||
boolean place = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
|
||||
boolean place = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, state);
|
||||
|
||||
if(place)
|
||||
{
|
||||
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(x, y, z);
|
||||
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(pos);
|
||||
tileEntity.tier = ((IEnergyCube)stack.getItem()).getEnergyCubeTier(stack);
|
||||
tileEntity.electricityStored = getEnergy(stack);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import mekanism.common.base.ISustainedInventory;
|
||||
import mekanism.common.tile.TileEntityGasTank;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -22,7 +23,8 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
|
||||
@@ -53,12 +55,6 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int i)
|
||||
{
|
||||
return metaBlock.getIcon(2, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
@@ -66,13 +62,13 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState state)
|
||||
{
|
||||
boolean place = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
|
||||
boolean place = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, state);
|
||||
|
||||
if(place)
|
||||
{
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(x, y, z);
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(pos);
|
||||
tileEntity.gasTank.setGas(getGas(stack));
|
||||
|
||||
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));
|
||||
@@ -82,7 +78,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
GasStack gasStack = getGas(itemstack);
|
||||
|
||||
@@ -161,7 +157,7 @@ public class ItemBlockGasTank extends ItemBlock implements IGasItem, ISustainedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> list)
|
||||
{
|
||||
ItemStack empty = new ItemStack(this);
|
||||
setGas(empty, null);
|
||||
|
||||
@@ -32,6 +32,7 @@ import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -43,6 +44,8 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -153,7 +156,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
MachineType type = MachineType.get(itemstack);
|
||||
|
||||
@@ -226,7 +229,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
MachineType type = MachineType.get(stack);
|
||||
|
||||
@@ -235,11 +238,11 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
|
||||
return super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState state)
|
||||
{
|
||||
boolean place = true;
|
||||
|
||||
@@ -247,15 +250,16 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
|
||||
if(type == MachineType.DIGITAL_MINER)
|
||||
{
|
||||
for(int xPos = x-1; xPos <= x+1; xPos++)
|
||||
for(int xPos = -1; xPos <= +1; xPos++)
|
||||
{
|
||||
for(int yPos = y; yPos <= y+1; yPos++)
|
||||
for(int yPos = 0; yPos <= +1; yPos++)
|
||||
{
|
||||
for(int zPos = z-1; zPos <= z+1; zPos++)
|
||||
for(int zPos = -1; zPos <= +1; zPos++)
|
||||
{
|
||||
Block b = world.getBlock(xPos, yPos, zPos);
|
||||
BlockPos pos1 = pos.add(xPos, yPos, zPos);
|
||||
Block b = world.getBlockState(pos1).getBlock();
|
||||
|
||||
if(yPos > 255 || !b.isReplaceable(world, xPos, yPos, zPos))
|
||||
if(yPos > 255 || !b.isReplaceable(world, pos1))
|
||||
{
|
||||
place = false;
|
||||
}
|
||||
@@ -265,15 +269,15 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
}
|
||||
else if(type == MachineType.SOLAR_NEUTRON_ACTIVATOR)
|
||||
{
|
||||
if(y+1 > 255 || !world.getBlock(x, y+1, z).isReplaceable(world, x, y+1, z))
|
||||
if(pos.getY()+1 > 255 || !world.getBlockState(pos.up()).getBlock().isReplaceable(world, pos.up()))
|
||||
{
|
||||
place = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(place && super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata))
|
||||
if(place && super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, state))
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(x, y, z);
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof IUpgradeTile)
|
||||
{
|
||||
@@ -316,7 +320,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
factory.recipeType = recipeType;
|
||||
factory.upgradeComponent.setSupported(Upgrade.GAS, recipeType.fuelEnergyUpgrades());
|
||||
factory.secondaryEnergyPerTick = factory.getSecondaryEnergyPerTick(recipeType);
|
||||
world.notifyBlocksOfNeighborChange(x, y, z, tileEntity.getBlockType());
|
||||
world.notifyNeighborsOfStateChange(pos, tileEntity.getBlockType());
|
||||
}
|
||||
|
||||
if(tileEntity instanceof ISustainedTank)
|
||||
@@ -452,37 +456,37 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean tryPlaceContainedLiquid(World world, ItemStack itemstack, int x, int y, int z)
|
||||
public boolean tryPlaceContainedLiquid(World world, ItemStack itemstack, BlockPos pos)
|
||||
{
|
||||
if(getFluidStack(itemstack) == null || !getFluidStack(itemstack).getFluid().canBePlacedInWorld())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Material material = world.getBlock(x, y, z).getMaterial();
|
||||
Material material = world.getBlockState(pos).getBlock().getMaterial();
|
||||
boolean flag = !material.isSolid();
|
||||
|
||||
if(!world.isAirBlock(x, y, z) && !flag)
|
||||
if(!world.isAirBlock(pos) && !flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(world.provider.isHellWorld && getFluidStack(itemstack).getFluid() == FluidRegistry.WATER)
|
||||
if(world.provider.doesWaterVaporize() && getFluidStack(itemstack).getFluid() == FluidRegistry.WATER)
|
||||
{
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
world.playSoundEffect(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
|
||||
for(int l = 0; l < 8; l++)
|
||||
{
|
||||
world.spawnParticle("largesmoke", x + Math.random(), y + Math.random(), z + Math.random(), 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!world.isRemote && flag && !material.isLiquid())
|
||||
{
|
||||
world.func_147480_a(x, y, z, true);
|
||||
//TODO: world.breakBlock(pos, true);
|
||||
}
|
||||
|
||||
world.setBlock(x, y, z, MekanismUtils.getFlowingBlock(getFluidStack(itemstack).getFluid()), 0, 3);
|
||||
world.setBlockState(pos, MekanismUtils.getFlowingBlock(getFluidStack(itemstack).getFluid()).getDefaultState(), 3);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -524,16 +528,16 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
else {
|
||||
if(pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
Coord4D coord = new Coord4D(pos.blockX, pos.blockY, pos.blockZ, world.provider.getDimensionId());
|
||||
Coord4D coord = new Coord4D(pos.getBlockPos(), world.provider.getDimensionId());
|
||||
|
||||
if(!world.canMineBlock(entityplayer, coord.xCoord, coord.yCoord, coord.zCoord))
|
||||
if(!world.provider.canMineBlock(entityplayer, coord))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
if(!entityplayer.canPlayerEdit(coord.xCoord, coord.yCoord, coord.zCoord, pos.sideHit, itemstack))
|
||||
if(!entityplayer.canPlayerEdit(coord, pos.sideHit, itemstack))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
@@ -559,7 +563,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
setFluidStack(newStack, itemstack);
|
||||
}
|
||||
|
||||
world.setBlockToAir(coord.xCoord, coord.yCoord, coord.zCoord);
|
||||
world.setBlockToAir(coord);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -570,14 +574,14 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
Coord4D trans = coord.offset(EnumFacing.getFront(pos.sideHit));
|
||||
Coord4D trans = coord.offset(pos.sideHit);
|
||||
|
||||
if(!entityplayer.canPlayerEdit(trans.xCoord, trans.yCoord, trans.zCoord, pos.sideHit, itemstack))
|
||||
if(!entityplayer.canPlayerEdit(trans, pos.sideHit, itemstack))
|
||||
{
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if(tryPlaceContainedLiquid(world, itemstack, trans.xCoord, trans.yCoord, trans.zCoord) && !entityplayer.capabilities.isCreativeMode)
|
||||
if(tryPlaceContainedLiquid(world, itemstack, trans) && !entityplayer.capabilities.isCreativeMode)
|
||||
{
|
||||
FluidStack newStack = stored.copy();
|
||||
newStack.amount -= FluidContainerRegistry.BUCKET_VOLUME;
|
||||
@@ -662,7 +666,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(fluidStack == null || fluidStack.amount == 0 || fluidStack.getFluidID() == 0)
|
||||
if(fluidStack == null || fluidStack.amount == 0 || fluidStack.getFluid() == null)
|
||||
{
|
||||
itemStack.getTagCompound().removeTag("fluidTank");
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -37,7 +36,7 @@ public class ItemBlockOre extends ItemBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey))
|
||||
{
|
||||
@@ -54,11 +53,13 @@ public class ItemBlockOre extends ItemBlock
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int i)
|
||||
{
|
||||
return metaBlock.getIcon(2, i);
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
|
||||
@@ -7,7 +7,6 @@ import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ItemBlockPlastic extends ItemBlock
|
||||
@@ -27,11 +26,13 @@ public class ItemBlockPlastic extends ItemBlock
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int i)
|
||||
{
|
||||
return metaBlock.getIcon(2, i);
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Resource;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemClump extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public ItemClump()
|
||||
{
|
||||
super();
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -42,6 +35,7 @@ public class ItemClump extends ItemMekanism
|
||||
itemList.add(new ItemStack(this, 1, counter));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item)
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -54,19 +55,19 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
super.addInformation(itemstack, entityplayer, list, flag);
|
||||
list.add(EnumColor.PINK + LangUtils.localize("gui.state") + ": " + getColor(getState(itemstack)) + getStateDisplay(getState(itemstack)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(getState(stack).isConfigurating()) //Configurate
|
||||
{
|
||||
@@ -144,7 +145,7 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
|
||||
}
|
||||
|
||||
slotStack.stackSize -= j;
|
||||
EntityItem item = new EntityItem(world, x + xRandom, y + yRandom, z + zRandom, new ItemStack(slotStack.getItem(), j, slotStack.getItemDamage()));
|
||||
EntityItem item = new EntityItem(world, pos.getX() + xRandom, pos.getY() + yRandom, pos.getZ() + zRandom, new ItemStack(slotStack.getItem(), j, slotStack.getItemDamage()));
|
||||
|
||||
if(slotStack.hasTagCompound())
|
||||
{
|
||||
@@ -173,16 +174,15 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
|
||||
}
|
||||
else if(getState(stack) == ConfiguratorMode.ROTATE) //Rotate
|
||||
{
|
||||
EnumFacing axis = EnumFacing.getFront(side);
|
||||
List<EnumFacing> l = Arrays.asList(block.getValidRotations(world, x, y, z));
|
||||
List<EnumFacing> l = Arrays.asList(block.getValidRotations(world, pos));
|
||||
|
||||
if(!player.isSneaking() && l.contains(axis))
|
||||
if(!player.isSneaking() && l.contains(side))
|
||||
{
|
||||
block.rotateBlock(world, x, y, z, axis);
|
||||
block.rotateBlock(world, pos, side);
|
||||
}
|
||||
else if(player.isSneaking() && l.contains(axis.getOpposite()))
|
||||
else if(player.isSneaking() && l.contains(side.getOpposite()))
|
||||
{
|
||||
block.rotateBlock(world, x, y, z, axis.getOpposite());
|
||||
block.rotateBlock(world, pos, side.getOpposite());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -251,35 +251,35 @@ public class ItemConfigurator extends ItemEnergized implements IMekWrench, ITool
|
||||
|
||||
@Override
|
||||
@Method(modid = "BuildCraft")
|
||||
public boolean canWrench(EntityPlayer player, int x, int y, int z)
|
||||
public boolean canWrench(EntityPlayer player, BlockPos pos)
|
||||
{
|
||||
return canUseWrench(player, x, y, z);
|
||||
return canUseWrench(player, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method(modid = "BuildCraft")
|
||||
public void wrenchUsed(EntityPlayer player, int x, int y, int z) {}
|
||||
public void wrenchUsed(EntityPlayer player, BlockPos pos) {}
|
||||
|
||||
@Override
|
||||
public boolean canUseWrench(EntityPlayer player, int x, int y, int z)
|
||||
public boolean canUseWrench(EntityPlayer player, BlockPos pos)
|
||||
{
|
||||
return getState(player.getCurrentEquippedItem()) == ConfiguratorMode.WRENCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player)
|
||||
public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
return getState(player.getCurrentEquippedItem()) == ConfiguratorMode.WRENCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsable(ItemStack item, EntityLivingBase user, int x, int y, int z)
|
||||
public boolean isUsable(ItemStack item, EntityLivingBase user, BlockPos pos)
|
||||
{
|
||||
return user instanceof EntityPlayer && canUseWrench((EntityPlayer)user, x, y, z);
|
||||
return user instanceof EntityPlayer && canUseWrench((EntityPlayer)user, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed(ItemStack item, EntityLivingBase user, int x, int y, int z) {}
|
||||
public void toolUsed(ItemStack item, EntityLivingBase user, BlockPos pos) {}
|
||||
|
||||
public static enum ConfiguratorMode
|
||||
{
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemControlCircuit extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public ItemControlCircuit()
|
||||
{
|
||||
super();
|
||||
@@ -22,6 +14,7 @@ public class ItemControlCircuit extends ItemMekanism
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -51,6 +44,7 @@ public class ItemControlCircuit extends ItemMekanism
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item)
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Resource;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemCrystal extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public ItemCrystal()
|
||||
{
|
||||
super();
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -42,6 +35,7 @@ public class ItemCrystal extends ItemMekanism
|
||||
itemList.add(new ItemStack(item, 1, counter));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item)
|
||||
|
||||
@@ -7,9 +7,12 @@ import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
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.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemDictionary extends ItemMekanism
|
||||
@@ -21,17 +24,18 @@ public class ItemDictionary extends ItemMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!player.isSneaking())
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if(block != null)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
ItemStack testStack = new ItemStack(block, 1, world.getBlockMetadata(x, y, z));
|
||||
ItemStack testStack = new ItemStack(block, 1, block.getMetaFromState(state));
|
||||
List<String> names = MekanismUtils.getOreDictName(testStack);
|
||||
|
||||
if(!names.isEmpty())
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Resource;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemDirtyDust extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public ItemDirtyDust()
|
||||
{
|
||||
super();
|
||||
@@ -22,6 +14,7 @@ public class ItemDirtyDust extends ItemMekanism
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -45,6 +38,7 @@ public class ItemDirtyDust extends ItemMekanism
|
||||
itemList.add(new ItemStack(item, 1, counter));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item)
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Resource;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemDust extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public ItemDust()
|
||||
{
|
||||
super();
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -42,6 +35,7 @@ public class ItemDust extends ItemMekanism
|
||||
itemList.add(new ItemStack(this, 1, counter));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item)
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ItemElectricBow extends ItemEnergized
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
super.addInformation(itemstack, entityplayer, list, flag);
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ItemElectricBow extends ItemEnergized
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack itemstack)
|
||||
{
|
||||
return EnumAction.bow;
|
||||
return EnumAction.BOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, ISpec
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
list.add(EnumColor.AQUA + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack)));
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class ItemEnergized extends ItemMekanism implements IEnergizedItem, ISpec
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> list)
|
||||
{
|
||||
ItemStack discharged = new ItemStack(this);
|
||||
discharged.setItemDamage(100);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import mekanism.common.Tier.FactoryTier;
|
||||
import mekanism.common.base.IFactory.RecipeType;
|
||||
@@ -10,19 +8,16 @@ import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityElectricMachine;
|
||||
import mekanism.common.tile.TileEntityFactory;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
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.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemFactoryInstaller extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public ItemFactoryInstaller()
|
||||
{
|
||||
super();
|
||||
@@ -31,14 +26,14 @@ public class ItemFactoryInstaller extends ItemMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(world.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
FactoryTier tier = FactoryTier.values()[stack.getItemDamage()];
|
||||
|
||||
if(tile instanceof TileEntityBasicBlock && ((TileEntityBasicBlock)tile).playersUsing.size() > 0)
|
||||
@@ -72,8 +67,8 @@ public class ItemFactoryInstaller extends ItemMekanism
|
||||
for(RecipeType iterType : RecipeType.values())
|
||||
{
|
||||
ItemStack machineStack = iterType.getStack();
|
||||
|
||||
if(Block.getBlockFromItem(machineStack.getItem()) == world.getBlock(x, y, z) && machineStack.getItemDamage() == world.getBlockMetadata(x, y, z))
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if(Block.getBlockFromItem(machineStack.getItem()) == state.getBlock() && machineStack.getItemDamage() == state.getBlock().getMetaFromState(state))
|
||||
{
|
||||
type = iterType;
|
||||
break;
|
||||
@@ -115,6 +110,7 @@ public class ItemFactoryInstaller extends ItemMekanism
|
||||
return 5+tier.processes+operation;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -131,13 +127,14 @@ public class ItemFactoryInstaller extends ItemMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List itemList)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> itemList)
|
||||
{
|
||||
for(FactoryTier tier : FactoryTier.values())
|
||||
{
|
||||
itemList.add(new ItemStack(item, 1, tier.ordinal()));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item)
|
||||
|
||||
@@ -9,7 +9,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.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemFilterCard extends ItemMekanism
|
||||
@@ -22,7 +24,7 @@ public class ItemFilterCard extends ItemMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
super.addInformation(itemstack, entityplayer, list, flag);
|
||||
|
||||
@@ -30,11 +32,11 @@ public class ItemFilterCard extends ItemMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof IFilterAccess)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@ import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -31,7 +30,7 @@ public class ItemFlamethrower extends ItemMekanism implements IGasItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
GasStack gasStack = getGas(itemstack);
|
||||
|
||||
@@ -46,10 +45,12 @@ public class ItemFlamethrower extends ItemMekanism implements IGasItem
|
||||
list.add(EnumColor.GREY + LangUtils.localize("tooltip.mode") + ": " + EnumColor.GREY + getMode(itemstack).getName());
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {}
|
||||
|
||||
*/
|
||||
|
||||
public void useGas(ItemStack stack)
|
||||
{
|
||||
setGas(stack, new GasStack(getGas(stack).getGas(), getGas(stack).amount - 1));
|
||||
@@ -167,7 +168,7 @@ public class ItemFlamethrower extends ItemMekanism implements IGasItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> list)
|
||||
{
|
||||
ItemStack empty = new ItemStack(this);
|
||||
setGas(empty, null);
|
||||
|
||||
@@ -12,7 +12,6 @@ import mekanism.common.integration.IC2ItemManager;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -45,16 +44,18 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci
|
||||
|
||||
public ItemFreeRunners()
|
||||
{
|
||||
super(EnumHelper.addArmorMaterial("FRICTIONBOOTS", 0, new int[] {0, 0, 0, 0}, 0), 0, 3);
|
||||
super(EnumHelper.addArmorMaterial("FRICTIONBOOTS", "frictionboots", 0, new int[] {0, 0, 0, 0}, 0), 0, 3);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(100);
|
||||
setNoRepair();
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean isValidArmor(ItemStack stack, int armorType, Entity entity)
|
||||
@@ -78,7 +79,7 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
list.add(EnumColor.AQUA + LangUtils.localize("tooltip.storedEnergy") + ": " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack)));
|
||||
}
|
||||
@@ -91,7 +92,7 @@ public class ItemFreeRunners extends ItemArmor implements IEnergizedItem, ISpeci
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> list)
|
||||
{
|
||||
ItemStack discharged = new ItemStack(this);
|
||||
discharged.setItemDamage(100);
|
||||
|
||||
@@ -5,7 +5,6 @@ import mekanism.client.render.ModelCustomArmor.ArmorModel;
|
||||
import mekanism.common.Mekanism;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
@@ -21,13 +20,15 @@ public class ItemGasMask extends ItemArmor
|
||||
{
|
||||
public ItemGasMask()
|
||||
{
|
||||
super(EnumHelper.addArmorMaterial("GASMASK", 0, new int[] {0, 0, 0, 0}, 0), 0, 0);
|
||||
super(EnumHelper.addArmorMaterial("GASMASK", "gasmask", 0, new int[] {0, 0, 0, 0}, 0), 0, 0);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean isValidArmor(ItemStack stack, int armorType, Entity entity)
|
||||
|
||||
@@ -13,6 +13,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -62,13 +64,13 @@ public class ItemGaugeDropper extends ItemMekanism implements IGasItem, IFluidCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> list)
|
||||
{
|
||||
list.add(getEmptyItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(player.isSneaking() && !world.isRemote)
|
||||
{
|
||||
@@ -82,7 +84,7 @@ public class ItemGaugeDropper extends ItemMekanism implements IGasItem, IFluidCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
GasStack gasStack = getGas(itemstack);
|
||||
FluidStack fluidStack = getFluid(itemstack);
|
||||
@@ -130,7 +132,7 @@ public class ItemGaugeDropper extends ItemMekanism implements IGasItem, IFluidCo
|
||||
container.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(stack == null || stack.amount == 0 || stack.getFluidID() == 0)
|
||||
if(stack == null || stack.amount == 0 || stack.getFluid() == null)
|
||||
{
|
||||
container.getTagCompound().removeTag("fluidStack");
|
||||
}
|
||||
|
||||
@@ -4,16 +4,12 @@ import java.util.List;
|
||||
|
||||
import mekanism.common.Mekanism;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemHDPE extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public ItemHDPE()
|
||||
{
|
||||
super();
|
||||
@@ -21,6 +17,7 @@ public class ItemHDPE extends ItemMekanism
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -35,9 +32,10 @@ public class ItemHDPE extends ItemMekanism
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List itemList)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> itemList)
|
||||
{
|
||||
for(int counter = 0; counter < PlasticItem.values().length; counter++)
|
||||
{
|
||||
|
||||
@@ -2,17 +2,13 @@ package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemIngot extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public static String[] en_USNames = {"Obsidian", "Osmium", "Bronze",
|
||||
public static String[] en_USNames = {"Obsidian", "Osmium", "Bronze",
|
||||
"Glowstone", "Steel", "Copper",
|
||||
"Tin"};
|
||||
|
||||
@@ -22,6 +18,7 @@ public class ItemIngot extends ItemMekanism
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -36,9 +33,10 @@ public class ItemIngot extends ItemMekanism
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List itemList)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> itemList)
|
||||
{
|
||||
for(int counter = 0; counter <= 6; counter++)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismItems;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -35,18 +34,20 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
|
||||
|
||||
public ItemJetpack()
|
||||
{
|
||||
super(EnumHelper.addArmorMaterial("JETPACK", 0, new int[] {0, 0, 0, 0}, 0), 0, 1);
|
||||
super(EnumHelper.addArmorMaterial("JETPACK", "jetpack", 0, new int[] {0, 0, 0, 0}, 0), 0, 1);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
setMaxDamage(100);
|
||||
setNoRepair();
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
GasStack gasStack = getGas(itemstack);
|
||||
|
||||
@@ -233,7 +234,7 @@ public class ItemJetpack extends ItemArmor implements IGasItem, ISpecialArmor
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> list)
|
||||
{
|
||||
ItemStack empty = new ItemStack(this);
|
||||
setGas(empty, null);
|
||||
|
||||
@@ -14,6 +14,7 @@ import mekanism.api.transmitters.TransmitterNetworkRegistry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -28,11 +29,11 @@ public class ItemNetworkReader extends ItemEnergized
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
boolean drain = !player.capabilities.isCreativeMode;
|
||||
|
||||
if(getEnergy(stack) >= ENERGY_PER_USE)
|
||||
|
||||
@@ -2,17 +2,13 @@ package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemOtherDust extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public static String[] subtypes = {"Diamond", "Steel", "Lead",
|
||||
public static String[] subtypes = {"Diamond", "Steel", "Lead",
|
||||
"Sulfur", "Lithium", "RefinedObsidian",
|
||||
"Obsidian"};
|
||||
|
||||
@@ -22,6 +18,7 @@ public class ItemOtherDust extends ItemMekanism
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -36,9 +33,10 @@ public class ItemOtherDust extends ItemMekanism
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List itemList)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> itemList)
|
||||
{
|
||||
for(int counter = 0; counter < subtypes.length; counter++)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ItemPortableTeleporter extends ItemEnergized
|
||||
neededEnergy+=10000;
|
||||
}
|
||||
|
||||
int distance = (int)entity.getDistance(coords.xCoord, coords.yCoord, coords.zCoord);
|
||||
int distance = (int)entity.getDistance(coords.getX(), coords.getY(), coords.getZ());
|
||||
|
||||
neededEnergy+=(distance*10);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -22,11 +21,13 @@ public class ItemProxy extends Item
|
||||
return getSavedItem(stack);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack)
|
||||
{
|
||||
return stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("hasStack");
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(ItemStack itemStack)
|
||||
@@ -67,9 +68,6 @@ public class ItemProxy extends Item
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
|
||||
{
|
||||
|
||||
@@ -8,12 +8,13 @@ import mekanism.common.base.ISustainedInventory;
|
||||
import mekanism.common.entity.EntityRobit;
|
||||
import mekanism.common.tile.TileEntityChargepad;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -27,11 +28,7 @@ public class ItemRobit extends ItemEnergized implements ISustainedInventory
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
super.addInformation(itemstack, entityplayer, list, flag);
|
||||
|
||||
@@ -40,9 +37,9 @@ public class ItemRobit extends ItemEnergized implements ISustainedInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int x, int y, int z, int side, float posX, float posY, float posZ)
|
||||
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, BlockPos pos, EnumFacing side, float posX, float posY, float posZ)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if(tileEntity instanceof TileEntityChargepad)
|
||||
{
|
||||
@@ -51,7 +48,7 @@ public class ItemRobit extends ItemEnergized implements ISustainedInventory
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
EntityRobit robit = new EntityRobit(world, x+0.5, y+0.1, z+0.5);
|
||||
EntityRobit robit = new EntityRobit(world, pos.getX()+0.5, pos.getY()+0.1, pos.getZ()+0.5);
|
||||
|
||||
robit.setHome(Coord4D.get(chargepad));
|
||||
robit.setEnergy(getEnergy(itemstack));
|
||||
|
||||
@@ -13,7 +13,6 @@ import mekanism.client.render.ModelCustomArmor.ArmorModel;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -32,14 +31,14 @@ public class ItemScubaTank extends ItemArmor implements IGasItem
|
||||
|
||||
public ItemScubaTank()
|
||||
{
|
||||
super(EnumHelper.addArmorMaterial("SCUBATANK", 0, new int[] {0, 0, 0, 0}, 0), 0, 1);
|
||||
super(EnumHelper.addArmorMaterial("SCUBATANK", "scubatank", 0, new int[] {0, 0, 0, 0}, 0), 0, 1);
|
||||
setCreativeTab(Mekanism.tabMekanism);
|
||||
setMaxDamage(100);
|
||||
setNoRepair();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
GasStack gasStack = getGas(itemstack);
|
||||
|
||||
@@ -239,7 +238,7 @@ public class ItemScubaTank extends ItemArmor implements IGasItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list)
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List<ItemStack> list)
|
||||
{
|
||||
ItemStack empty = new ItemStack(this);
|
||||
setGas(empty, null);
|
||||
@@ -250,8 +249,4 @@ public class ItemScubaTank extends ItemArmor implements IGasItem
|
||||
setGas(filled, new GasStack(GasRegistry.getGas("oxygen"), ((IGasItem)filled.getItem()).getMaxGas(filled)));
|
||||
list.add(filled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {}
|
||||
}
|
||||
@@ -1,24 +1,17 @@
|
||||
package mekanism.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Resource;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemShard extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public ItemShard()
|
||||
{
|
||||
super();
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register)
|
||||
{
|
||||
@@ -42,6 +35,7 @@ public class ItemShard extends ItemMekanism
|
||||
itemList.add(new ItemStack(item, 1, counter));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item)
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ItemUpgrade extends ItemMekanism implements IUpgradeItem
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
|
||||
@@ -4,17 +4,13 @@ import java.util.List;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemWalkieTalkie extends ItemMekanism
|
||||
{
|
||||
public IIcon[] icons = new IIcon[256];
|
||||
|
||||
public ItemWalkieTalkie()
|
||||
{
|
||||
super();
|
||||
@@ -22,7 +18,7 @@ public class ItemWalkieTalkie extends ItemMekanism
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag)
|
||||
{
|
||||
super.addInformation(itemstack, entityplayer, list, flag);
|
||||
|
||||
@@ -30,6 +26,7 @@ public class ItemWalkieTalkie extends ItemMekanism
|
||||
list.add(EnumColor.DARK_AQUA + LangUtils.localize("tooltip.channel") + ": " + EnumColor.GREY + getChannel(itemstack));
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack itemStack)
|
||||
{
|
||||
@@ -51,6 +48,7 @@ public class ItemWalkieTalkie extends ItemMekanism
|
||||
icons[i] = register.registerIcon("mekanism:WalkieTalkie_ch" + i);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PacketConfigurationUpdate implements IMessageHandler<ConfigurationU
|
||||
}
|
||||
else if(message.clickType == 2)
|
||||
{
|
||||
((ISideConfiguration)tile).getConfig().getConfig(message.transmission)[message.configIndex] = 0;
|
||||
((ISideConfiguration)tile).getConfig().getConfig(message.transmission)[message.configIndex.ordinal()] = 0;
|
||||
}
|
||||
|
||||
tile.markDirty();
|
||||
@@ -107,7 +107,7 @@ public class PacketConfigurationUpdate implements IMessageHandler<ConfigurationU
|
||||
{
|
||||
public Coord4D coord4D;
|
||||
|
||||
public int configIndex;
|
||||
public EnumFacing configIndex;
|
||||
|
||||
public int inputSide;
|
||||
|
||||
@@ -138,7 +138,7 @@ public class PacketConfigurationUpdate implements IMessageHandler<ConfigurationU
|
||||
if(packetType == ConfigurationPacket.SIDE_DATA)
|
||||
{
|
||||
clickType = click;
|
||||
configIndex = extra;
|
||||
configIndex = EnumFacing.getFront(extra);
|
||||
transmission = trans;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ public class PacketConfigurationUpdate implements IMessageHandler<ConfigurationU
|
||||
|
||||
if(packetType == ConfigurationPacket.SIDE_DATA)
|
||||
{
|
||||
dataStream.writeInt(configIndex);
|
||||
dataStream.writeInt(configIndex.ordinal());
|
||||
dataStream.writeInt(transmission.ordinal());
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public class PacketConfigurationUpdate implements IMessageHandler<ConfigurationU
|
||||
else if(packetType == ConfigurationPacket.SIDE_DATA)
|
||||
{
|
||||
clickType = dataStream.readInt();
|
||||
configIndex = dataStream.readInt();
|
||||
configIndex = EnumFacing.getFront(dataStream.readInt());
|
||||
transmission = TransmissionType.values()[dataStream.readInt()];
|
||||
}
|
||||
else if(packetType == ConfigurationPacket.EJECT_COLOR)
|
||||
|
||||
@@ -32,7 +32,7 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
|
||||
|
||||
public FluidTank fluidTank = new FluidTank(10000);
|
||||
|
||||
private static EnumSet<EnumFacing> dirs = EnumSet.complementOf(EnumSet.of(EnumFacing.UP, EnumFacing.null));
|
||||
private static EnumSet<EnumFacing> dirs = EnumSet.complementOf(EnumSet.of(EnumFacing.UP));
|
||||
private static int MAX_NODES = 4000;
|
||||
|
||||
public TileEntityFluidicPlenisher()
|
||||
|
||||
@@ -68,7 +68,7 @@ public abstract class TileEntityNoisyElectricBlock extends TileEntityElectricBlo
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getPitch()
|
||||
public float getFrequency()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
|
||||
@@ -61,15 +61,15 @@ public class TileComponentConfig implements ITileComponent
|
||||
canEject.put(type.ordinal(), true);
|
||||
}
|
||||
|
||||
public EnumSet<EnumFacing> getSidesForData(TransmissionType type, int facing, int dataIndex)
|
||||
public EnumSet<EnumFacing> getSidesForData(TransmissionType type, EnumFacing facing, int dataIndex)
|
||||
{
|
||||
EnumSet<EnumFacing> ret = EnumSet.noneOf(EnumFacing.class);
|
||||
|
||||
for(byte b = 0; b < 6; b++)
|
||||
for(EnumFacing f : EnumFacing.VALUES)
|
||||
{
|
||||
if(getConfig(type)[b] == dataIndex)
|
||||
if(getConfig(type)[f.ordinal()] == dataIndex)
|
||||
{
|
||||
ret.add(EnumFacing.getFront(MekanismUtils.getBaseOrientation(b, facing)));
|
||||
ret.add(MekanismUtils.getBaseOrientation(f, facing));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,9 +131,9 @@ public class TileComponentConfig implements ITileComponent
|
||||
return sideConfigs.get(type.ordinal());
|
||||
}
|
||||
|
||||
public SideData getOutput(TransmissionType type, int side, int facing)
|
||||
public SideData getOutput(TransmissionType type, EnumFacing side, EnumFacing facing)
|
||||
{
|
||||
return getOutputs(type).get(getConfig(type)[MekanismUtils.getBaseOrientation(side, facing)]);
|
||||
return getOutputs(type).get(getConfig(type)[MekanismUtils.getBaseOrientation(side, facing).ordinal()]);
|
||||
}
|
||||
|
||||
public SideData getOutput(TransmissionType type, int side)
|
||||
|
||||
@@ -503,10 +503,11 @@ public final class MekanismUtils
|
||||
* Increments the output type of a machine's side.
|
||||
* @param config - configurable machine
|
||||
* @param type - the TransmissionType to modify
|
||||
* @param side - side to increment output of
|
||||
* @param direction - side to increment output of
|
||||
*/
|
||||
public static void incrementOutput(ISideConfiguration config, TransmissionType type, int side)
|
||||
public static void incrementOutput(ISideConfiguration config, TransmissionType type, EnumFacing direction)
|
||||
{
|
||||
int side = direction.ordinal();
|
||||
int max = config.getConfig().getOutputs(type).size()-1;
|
||||
int current = config.getConfig().getOutputs(type).indexOf(config.getConfig().getOutputs(type).get(config.getConfig().getConfig(type)[side]));
|
||||
|
||||
@@ -528,10 +529,11 @@ public final class MekanismUtils
|
||||
* Decrements the output type of a machine's side.
|
||||
* @param config - configurable machine
|
||||
* @param type - the TransmissionType to modify
|
||||
* @param side - side to increment output of
|
||||
* @param direction - side to increment output of
|
||||
*/
|
||||
public static void decrementOutput(ISideConfiguration config, TransmissionType type, int side)
|
||||
public static void decrementOutput(ISideConfiguration config, TransmissionType type, EnumFacing direction)
|
||||
{
|
||||
int side = direction.ordinal();
|
||||
int max = config.getConfig().getOutputs(type).size()-1;
|
||||
int current = config.getConfig().getOutputs(type).indexOf(config.getConfig().getOutputs(type).get(config.getConfig().getConfig(type)[side]));
|
||||
|
||||
@@ -1416,12 +1418,10 @@ public final class MekanismUtils
|
||||
/**
|
||||
* Whether or not the player has a usable wrench for a block at the coordinates given.
|
||||
* @param player - the player using the wrench
|
||||
* @param x - the x coordinate of the block being wrenched
|
||||
* @param y - the y coordinate of the block being wrenched
|
||||
* @param z - the z coordinate of the block being wrenched
|
||||
* @param pos - the coordinate of the block being wrenched
|
||||
* @return if the player can use the wrench
|
||||
*/
|
||||
public static boolean hasUsableWrench(EntityPlayer player, int x, int y, int z)
|
||||
public static boolean hasUsableWrench(EntityPlayer player, BlockPos pos)
|
||||
{
|
||||
ItemStack tool = player.getCurrentEquippedItem();
|
||||
|
||||
@@ -1430,17 +1430,17 @@ public final class MekanismUtils
|
||||
return false;
|
||||
}
|
||||
|
||||
if(tool.getItem() instanceof IMekWrench && ((IMekWrench)tool.getItem()).canUseWrench(player, x, y, z))
|
||||
if(tool.getItem() instanceof IMekWrench && ((IMekWrench)tool.getItem()).canUseWrench(player, pos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(isBCWrench(tool.getItem()) && ((IToolWrench)tool.getItem()).canWrench(player, x, y, z))
|
||||
if(isBCWrench(tool.getItem()) && ((IToolWrench)tool.getItem()).canWrench(player, pos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(isCoFHHammer(tool.getItem()) && ((IToolHammer)tool.getItem()).isUsable(tool, player, x, y, z))
|
||||
if(isCoFHHammer(tool.getItem()) && ((IToolHammer)tool.getItem()).isUsable(tool, player, pos))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -366,7 +366,7 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getPitch()
|
||||
public float getFrequency()
|
||||
{
|
||||
return 1F;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user