mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Allow suspending autosaw with a screwdriver
Localized, though I'm not sure if it really needs to be
This commit is contained in:
parent
8c196f05ca
commit
df8d456a90
@ -10,6 +10,7 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAutosaw;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -22,7 +23,7 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public class MachineAutosaw extends BlockContainer implements ILookOverlay, ITooltipProvider {
|
||||
public class MachineAutosaw extends BlockContainer implements ILookOverlay, ITooltipProvider, IToolable {
|
||||
|
||||
public MachineAutosaw() {
|
||||
super(Material.iron);
|
||||
@ -72,6 +73,24 @@ public class MachineAutosaw extends BlockContainer implements ILookOverlay, IToo
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
if(tool != ToolType.SCREWDRIVER)
|
||||
return false;
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(te instanceof TileEntityMachineAutosaw))
|
||||
return false;
|
||||
|
||||
TileEntityMachineAutosaw saw = (TileEntityMachineAutosaw) te;
|
||||
|
||||
saw.isSuspended = !saw.isSuspended;
|
||||
saw.markDirty();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHook(Pre event, World world, int x, int y, int z) {
|
||||
|
||||
@ -84,6 +103,10 @@ public class MachineAutosaw extends BlockContainer implements ILookOverlay, IToo
|
||||
|
||||
List<String> text = new ArrayList();
|
||||
text.add(saw.tank.getTankType().getLocalizedName() + ": " + saw.tank.getFill() + "/" + saw.tank.getMaxFill() + "mB");
|
||||
|
||||
if (saw.isSuspended) {
|
||||
text.add(EnumChatFormatting.RED + "! " + I18nUtil.resolveKey(getUnlocalizedName() + ".suspended") + " !");
|
||||
}
|
||||
|
||||
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
|
||||
}
|
||||
|
||||
@ -52,6 +52,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB
|
||||
public FluidTank tank;
|
||||
|
||||
public boolean isOn;
|
||||
public boolean isSuspended;
|
||||
private int forceSkip;
|
||||
public float syncYaw;
|
||||
public float rotationYaw;
|
||||
@ -88,7 +89,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB
|
||||
this.subscribeToAllAround(tank.getTankType(), this);
|
||||
}
|
||||
|
||||
if(isOn) {
|
||||
if(isOn && !isSuspended) {
|
||||
Vec3 pivot = Vec3.createVectorHelper(xCoord + 0.5, yCoord + 1.75, zCoord + 0.5);
|
||||
Vec3 upperArm = Vec3.createVectorHelper(0, 0, -4);
|
||||
upperArm.rotateAroundX((float) Math.toRadians(80 - rotationPitch));
|
||||
@ -202,7 +203,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB
|
||||
|
||||
this.lastSpin = this.spin;
|
||||
|
||||
if(isOn) {
|
||||
if(isOn && !isSuspended) {
|
||||
this.spin += 15F;
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper(0.625, 0, 1.625);
|
||||
@ -347,6 +348,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(this.isOn);
|
||||
buf.writeBoolean(this.isSuspended);
|
||||
buf.writeFloat(this.rotationYaw);
|
||||
buf.writeFloat(this.rotationPitch);
|
||||
this.tank.serialize(buf);
|
||||
@ -355,6 +357,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
this.isOn = buf.readBoolean();
|
||||
this.isSuspended = buf.readBoolean();
|
||||
this.syncYaw = buf.readFloat();
|
||||
this.syncPitch = buf.readFloat();
|
||||
this.turnProgress = 3; //use 3-ply for extra smoothness
|
||||
@ -365,6 +368,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.isOn = nbt.getBoolean("isOn");
|
||||
this.isSuspended = nbt.getBoolean("isSuspended");
|
||||
this.forceSkip = nbt.getInteger("skip");
|
||||
this.rotationYaw = nbt.getFloat("yaw");
|
||||
this.rotationPitch = nbt.getFloat("pitch");
|
||||
@ -376,6 +380,7 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setBoolean("isOn", this.isOn);
|
||||
nbt.setBoolean("isSuspended", this.isSuspended);
|
||||
nbt.setInteger("skip", this.forceSkip);
|
||||
nbt.setFloat("yaw", this.rotationYaw);
|
||||
nbt.setFloat("pitch", this.rotationPitch);
|
||||
|
||||
@ -4324,6 +4324,7 @@ tile.machine_assemfac.name=Fertigungsfabrik
|
||||
tile.machine_autocrafter.name=Automatische Werkbank
|
||||
tile.machine_autosaw.name=Automatische Kreissäge
|
||||
tile.machine_autosaw.desc=Schneidet Pflanzen nieder, pflanzt Bäume nach$Akzeptiert:$-Holzöl$-Ethanol$-Fischöl$-Schweröl
|
||||
tile.machine_autosaw.suspended=Angehalten
|
||||
tile.machine_bat9000.name=Big-Ass Tank 9000
|
||||
tile.machine_battery.name=Energiespeicherblock
|
||||
tile.machine_battery_potato.name=Kartoffelbatterieblock
|
||||
|
||||
@ -5458,6 +5458,7 @@ tile.machine_assemfac.name=Assembly Factory
|
||||
tile.machine_autocrafter.name=Automatic Crafting Table
|
||||
tile.machine_autosaw.name=Automatic Buzz Saw
|
||||
tile.machine_autosaw.desc=Cuts down nearby plants, re-plants trees$Accepts:$-Wood oil$-Ethanol$-Fish oil$-Heavy oil
|
||||
tile.machine_autosaw.suspended=Suspended
|
||||
tile.machine_bat9000.name=Big-Ass Tank 9000
|
||||
tile.machine_battery.name=Energy Storage Block
|
||||
tile.machine_battery_potato.name=Potato Battery Block
|
||||
|
||||
@ -5537,6 +5537,7 @@ tile.machine_assemfac.name=Assembly Factory
|
||||
tile.machine_autocrafter.name=Automatic Crafting Table
|
||||
tile.machine_autosaw.name=Automatic Buzz Saw
|
||||
tile.machine_autosaw.desc=Cuts down nearby plants, re-plants trees$Accepts:$-Wood oil$-Ethanol$-Fish oil$-Heavy oil
|
||||
tile.machine_autosaw.suspended=Suspended
|
||||
tile.machine_bat9000.name=Big-Ass Tank 9000
|
||||
tile.machine_battery.name=Energy Storage Block
|
||||
tile.machine_battery_potato.name=Potato Battery Block
|
||||
|
||||
@ -4873,6 +4873,7 @@ tile.machine_assembler.name=Assembly Machine
|
||||
tile.machine_assemfac.name=Assembly Factory
|
||||
tile.machine_autocrafter.name=Automatic Crafting Table
|
||||
tile.machine_autosaw.name=Automatic Buzz Saw
|
||||
tile.machine_autosaw.suspended=Suspended
|
||||
tile.machine_bat9000.name=Big-Ass Tank 9000
|
||||
tile.machine_battery.name=Energy Storage Block
|
||||
tile.machine_battery_potato.name=Potato Battery Block
|
||||
|
||||
@ -5720,6 +5720,7 @@ tile.machine_assemfac.name=Сборочный завод
|
||||
tile.machine_autocrafter.name=Автоматический верстак
|
||||
tile.machine_autosaw.name=Автоматическая пила
|
||||
tile.machine_autosaw.desc=Срубает ближайшие растения, пересаживает деревья$Принимает:$-Древесное масло$-Этанол$-Рыбное масло$-Тяжелую нефть
|
||||
tile.machine_autosaw.suspended=Приостановлена
|
||||
tile.machine_bat9000.name=Охереть-большая цистерна 9000
|
||||
tile.machine_battery.name=Энергохранилище
|
||||
tile.machine_battery_potato.name=Картофельная батарея
|
||||
|
||||
@ -5458,6 +5458,7 @@ tile.machine_assemfac.name=Збиральна фабрика
|
||||
tile.machine_autocrafter.name=Автоматичний верстак
|
||||
tile.machine_autosaw.name=Автоматична пила
|
||||
tile.machine_autosaw.desc=Вирубує рослини поруч, заново висажує дерева$Приймає:$-Деревну смолу$-Етанол$-Риб'ячий жир$-Важку нафту
|
||||
tile.machine_autosaw.suspended=Припинено
|
||||
tile.machine_bat9000.name=Big-Ass цистерна 9000
|
||||
tile.machine_battery.name=Блок накопичувач енергії
|
||||
tile.machine_battery_potato.name=Блок картопляних батарейок
|
||||
|
||||
@ -5188,6 +5188,7 @@ tile.machine_assemfac.name=装配厂
|
||||
tile.machine_autocrafter.name=自动工作台
|
||||
tile.machine_autosaw.name=自动嗡嗡锯
|
||||
tile.machine_autosaw.desc=砍伐附近的植物,重新种植树木$接受:$-木油$-乙醇$-鱼油$-重油
|
||||
tile.machine_autosaw.suspended=暂停
|
||||
tile.machine_bat9000.name=巨尻-9000 储罐
|
||||
tile.machine_battery.name=蓄电池
|
||||
tile.machine_battery_potato.name=马铃薯电池组
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user