mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
Update to 1.11.2. Untested, still using outdated MCMP
This commit is contained in:
1 parent
2b02042f4c
commit
6a42eb64e3
666 files changed
+11360
-3713
No files matched your search
@@ -1,6 +1,5 @@
|
||||
package mekanism.common.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
@@ -58,9 +57,11 @@ import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -220,7 +221,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos fromPos)
|
||||
{
|
||||
if(!world.isRemote)
|
||||
{
|
||||
@@ -299,7 +300,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, List<ItemStack> list)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativetabs, NonNullList<ItemStack> list)
|
||||
{
|
||||
for(BasicBlockType type : BasicBlockType.values())
|
||||
{
|
||||
@@ -412,10 +413,10 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
{
|
||||
if(!player.isSneaking())
|
||||
{
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, bin.removeStack().copy()));
|
||||
world.spawnEntity(new EntityItem(world, player.posX, player.posY, player.posZ, bin.removeStack().copy()));
|
||||
}
|
||||
else {
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, bin.remove(1).copy()));
|
||||
world.spawnEntity(new EntityItem(world, player.posX, player.posY, player.posZ, bin.remove(1).copy()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,10 +424,11 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
BasicBlockType type = BasicBlockType.get(state);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
ItemStack stack = entityplayer.getHeldItem(hand);
|
||||
|
||||
if(type == BasicBlockType.REFINED_OBSIDIAN)
|
||||
{
|
||||
@@ -487,13 +489,13 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
{
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, pos);
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, hand, stack, new RayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos));
|
||||
}
|
||||
|
||||
int change = bin.facing.rotateY().ordinal();
|
||||
|
||||
bin.setFacing((short)change);
|
||||
world.notifyNeighborsOfStateChange(pos, this);
|
||||
world.notifyNeighborsOfStateChange(pos, this, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -514,19 +516,19 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
}
|
||||
else if(bin.addTicks > 0 && bin.getItemCount() > 0)
|
||||
{
|
||||
ItemStack[] inv = entityplayer.inventory.mainInventory;
|
||||
NonNullList<ItemStack> inv = entityplayer.inventory.mainInventory;
|
||||
|
||||
for(int i = 0; i < inv.length; i++)
|
||||
for(int i = 0; i < inv.size(); i++)
|
||||
{
|
||||
if(bin.getItemCount() == bin.tier.storage)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(inv[i] != null)
|
||||
if(inv.get(i) != null)
|
||||
{
|
||||
ItemStack remain = bin.add(inv[i]);
|
||||
inv[i] = remain;
|
||||
ItemStack remain = bin.add(inv.get(i));
|
||||
inv.set(i, remain);
|
||||
bin.addTicks = 5;
|
||||
}
|
||||
|
||||
@@ -598,15 +600,15 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
{
|
||||
tileEntity.structure.fluidStored.amount -= filled;
|
||||
}
|
||||
else if(itemStack.stackSize == 1)
|
||||
else if(itemStack.getCount() == 1)
|
||||
{
|
||||
tileEntity.structure.fluidStored.amount -= filled;
|
||||
player.setHeldItem(hand, copyStack);
|
||||
}
|
||||
else if(itemStack.stackSize > 1 && player.inventory.addItemStackToInventory(copyStack))
|
||||
else if(itemStack.getCount() > 1 && player.inventory.addItemStackToInventory(copyStack))
|
||||
{
|
||||
tileEntity.structure.fluidStored.amount -= filled;
|
||||
itemStack.stackSize--;
|
||||
itemStack.shrink(1);
|
||||
}
|
||||
|
||||
if(tileEntity.structure.fluidStored.amount == 0)
|
||||
@@ -631,7 +633,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
boolean filled = false;
|
||||
FluidStack drained = handler.drain(needed, !player.capabilities.isCreativeMode);
|
||||
|
||||
if(copyStack.stackSize == 0)
|
||||
if(copyStack.getCount() == 0)
|
||||
{
|
||||
copyStack = null;
|
||||
}
|
||||
@@ -645,7 +647,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
else {
|
||||
if(copyStack != null)
|
||||
{
|
||||
if(itemStack.stackSize == 1)
|
||||
if(itemStack.getCount() == 1)
|
||||
{
|
||||
player.setHeldItem(hand, copyStack);
|
||||
filled = true;
|
||||
@@ -653,16 +655,16 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
else {
|
||||
if(player.inventory.addItemStackToInventory(copyStack))
|
||||
{
|
||||
itemStack.stackSize--;
|
||||
itemStack.shrink(1);
|
||||
|
||||
filled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
itemStack.stackSize--;
|
||||
itemStack.shrink(1);
|
||||
|
||||
if(itemStack.stackSize == 0)
|
||||
if(itemStack.getCount() == 0)
|
||||
{
|
||||
player.setHeldItem(hand, null);
|
||||
}
|
||||
@@ -777,7 +779,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
if(world.getTileEntity(pos) instanceof TileEntityBasicBlock)
|
||||
{
|
||||
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos);
|
||||
int side = MathHelper.floor_double((placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int side = MathHelper.floor((placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int height = Math.round(placer.rotationPitch);
|
||||
int change = 3;
|
||||
|
||||
@@ -910,7 +912,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, getPickBlock(state, null, world, pos, player));
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
world.spawnEntity(entityItem);
|
||||
}
|
||||
|
||||
return world.setBlockToAir(pos);
|
||||
@@ -931,7 +933,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + motionX, pos.getY() + motionY, pos.getZ() + motionZ, itemStack);
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
world.spawnEntity(entityItem);
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
@@ -1035,8 +1037,8 @@ public abstract class BlockBasic extends Block implements ICTMBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon)
|
||||
public boolean isBeaconBase(IBlockAccess world, BlockPos pos, BlockPos beacon)
|
||||
{
|
||||
return BasicBlockType.get(worldObj.getBlockState(pos)).isBeaconBase;
|
||||
return BasicBlockType.get(world.getBlockState(pos)).isBeaconBase;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user