some more texture work
This commit is contained in:
parent
f12725b4e0
commit
9f3622ea33
13 changed files with 253 additions and 107 deletions
|
@ -53,12 +53,12 @@ public class TileAesu extends TilePowerAcceptor implements IWrenchable {
|
|||
|
||||
@Override
|
||||
public short getFacing() {
|
||||
return (short) getRotation();
|
||||
return (short) getFacingInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacing(short facing) {
|
||||
setRotation(facing);
|
||||
setFacing(facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -144,12 +144,12 @@ public class TileAesu extends TilePowerAcceptor implements IWrenchable {
|
|||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return getRotation() != Functions.getIntDirFromDirection(direction);
|
||||
return getFacing() != Functions.getIntDirFromDirection(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return getRotation() == Functions.getIntDirFromDirection(direction);
|
||||
return getFacing() == Functions.getIntDirFromDirection(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
|
@ -13,10 +14,12 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import reborncore.common.BaseTileBlock;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.multiblock.IMultiblockPart;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
import techreborn.blocks.BlockMachineBase;
|
||||
import techreborn.blocks.BlockMachineCasing;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
@ -57,6 +60,10 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
|
|||
|
||||
@Override
|
||||
public short getFacing() {
|
||||
Block block = worldObj.getBlockState(pos).getBlock();
|
||||
if(block instanceof BlockMachineBase){
|
||||
return (short) ((BlockMachineBase) block).getFacing(worldObj.getBlockState(pos)).getIndex();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
package techreborn.tiles;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.ITickable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.common.packets.PacketHandler;
|
||||
import techreborn.blocks.BlockMachineBase;
|
||||
|
||||
public class TileMachineBase extends TileEntity implements ITickable {
|
||||
|
||||
int rotation;
|
||||
|
||||
public void syncWithAll() {
|
||||
if (!worldObj.isRemote) {
|
||||
PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(),
|
||||
|
@ -32,34 +33,6 @@ public class TileMachineBase extends TileEntity implements ITickable {
|
|||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
public int getRotation() {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void setRotation(int rotation) {
|
||||
this.rotation = rotation;
|
||||
syncWithAll();
|
||||
worldObj.notifyBlockOfStateChange(getPos(), blockType);
|
||||
worldObj.markBlockForUpdate(getPos());
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(), getPos().getY(), getPos().getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
if (tagCompound.hasKey("meta") && !tagCompound.hasKey("rotation")) {
|
||||
rotation = tagCompound.getInteger("meta");
|
||||
} else {
|
||||
rotation = tagCompound.getInteger("rotation");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
tagCompound.setInteger("rotation", rotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
updateEntity();
|
||||
|
@ -69,5 +42,28 @@ public class TileMachineBase extends TileEntity implements ITickable {
|
|||
|
||||
}
|
||||
|
||||
public int getFacingInt() {
|
||||
Block block = worldObj.getBlockState(pos).getBlock();
|
||||
if(block instanceof BlockMachineBase){
|
||||
return ((BlockMachineBase) block).getFacing(worldObj.getBlockState(pos)).getIndex();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public EnumFacing getFacingEnum() {
|
||||
Block block = worldObj.getBlockState(pos).getBlock();
|
||||
if(block instanceof BlockMachineBase){
|
||||
return ((BlockMachineBase) block).getFacing(worldObj.getBlockState(pos));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void setFacing(EnumFacing enumFacing) {
|
||||
Block block = worldObj.getBlockState(pos).getBlock();
|
||||
if(block instanceof BlockMachineBase){
|
||||
((BlockMachineBase) block).setFacing(enumFacing, worldObj, pos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -85,12 +85,12 @@ public class TileLesu extends TilePowerAcceptor {//TODO wrench
|
|||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return Functions.getIntDirFromDirection(direction) != getRotation();
|
||||
return direction != getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return Functions.getIntDirFromDirection(direction) == getRotation();
|
||||
return direction == getFacingEnum();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue