mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Merge branch 'development' into 1.8.9
This commit is contained in:
commit
0cb18773aa
1288 files changed
+11316
-7212
No files matched your search
@@ -7,9 +7,13 @@ import mekanism.common.Mekanism;
|
||||
import mekanism.common.MekanismBlocks;
|
||||
import mekanism.common.base.ISustainedInventory;
|
||||
import mekanism.common.base.ITierItem;
|
||||
import mekanism.common.security.ISecurityItem;
|
||||
import mekanism.common.security.ISecurityTile;
|
||||
import mekanism.common.security.ISecurityTile.SecurityMode;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.common.tile.TileEntityGasTank;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.SecurityUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -20,6 +24,7 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -81,6 +86,19 @@ public class BlockGasTank extends BlockContainer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile instanceof ISecurityTile)
|
||||
{
|
||||
return SecurityUtils.getSecurity((ISecurityTile)tile) == SecurityMode.PUBLIC ? blockHardness : -1;
|
||||
}
|
||||
|
||||
return blockHardness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
@@ -98,21 +116,28 @@ public class BlockGasTank extends BlockContainer
|
||||
|
||||
if(MekanismUtils.hasUsableWrench(entityplayer, pos))
|
||||
{
|
||||
if(entityplayer.isSneaking())
|
||||
if(SecurityUtils.canAccess(entityplayer, tileEntity))
|
||||
{
|
||||
dismantleBlock(world, pos, false);
|
||||
return true;
|
||||
if(entityplayer.isSneaking())
|
||||
{
|
||||
dismantleBlock(world, pos, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
{
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, pos);
|
||||
}
|
||||
|
||||
int change = tileEntity.facing.rotateY().ordinal();
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
world.notifyNeighborsOfStateChange(pos, this);
|
||||
}
|
||||
|
||||
if(MekanismUtils.isBCWrench(tool))
|
||||
{
|
||||
((IToolWrench)tool).wrenchUsed(entityplayer, pos);
|
||||
else {
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
|
||||
int change = tileEntity.facing.rotateY().ordinal();
|
||||
|
||||
tileEntity.setFacing((short)change);
|
||||
world.notifyNeighborsOfStateChange(pos, this);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -122,7 +147,14 @@ public class BlockGasTank extends BlockContainer
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 10, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
if(SecurityUtils.canAccess(entityplayer, tileEntity))
|
||||
{
|
||||
entityplayer.openGui(Mekanism.instance, 10, world, x, y, z);
|
||||
}
|
||||
else {
|
||||
SecurityUtils.displayNoAccess(entityplayer);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -205,6 +237,22 @@ public class BlockGasTank extends BlockContainer
|
||||
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(pos);
|
||||
ItemStack itemStack = new ItemStack(MekanismBlocks.GasTank);
|
||||
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(tileEntity instanceof ISecurityTile)
|
||||
{
|
||||
ISecurityItem securityItem = (ISecurityItem)itemStack.getItem();
|
||||
|
||||
if(securityItem.hasSecurity(itemStack))
|
||||
{
|
||||
securityItem.setOwner(itemStack, ((ISecurityTile)tileEntity).getSecurity().getOwner());
|
||||
securityItem.setSecurity(itemStack, ((ISecurityTile)tileEntity).getSecurity().getMode());
|
||||
}
|
||||
}
|
||||
|
||||
ITierItem tierItem = (ITierItem)itemStack.getItem();
|
||||
tierItem.setBaseTier(itemStack, tileEntity.tier.getBaseTier());
|
||||
|
||||
|
||||
Reference in new issue
Block a user