diff --git a/src/main/java/com/teammoeg/steampowered/client/ClientUtils.java b/src/main/java/com/teammoeg/steampowered/client/ClientUtils.java index a57e9a1..16ce7d6 100644 --- a/src/main/java/com/teammoeg/steampowered/client/ClientUtils.java +++ b/src/main/java/com/teammoeg/steampowered/client/ClientUtils.java @@ -18,7 +18,11 @@ package com.teammoeg.steampowered.client; +import com.simibubi.create.AllItems; + import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -32,4 +36,7 @@ public class ClientUtils { public static World getClientWorld() { return mc().level; } + public static boolean hasGoggles() { + return AllItems.GOGGLES.isIn(mc().player.getItemBySlot(EquipmentSlotType.HEAD)); + } } diff --git a/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlock.java b/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlock.java index 4989beb..88c481b 100644 --- a/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlock.java @@ -21,12 +21,15 @@ package com.teammoeg.steampowered.content.alternator; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.item.TooltipHelper; +import com.simibubi.create.foundation.item.ItemDescription.Palette; import com.simibubi.create.foundation.utility.VoxelShaper; import com.teammoeg.steampowered.SPConfig; import com.teammoeg.steampowered.block.SPShapes; import com.teammoeg.steampowered.registrate.SPTiles; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemGroup; @@ -129,6 +132,11 @@ public class DynamoBlock extends DirectionalKineticBlock implements ITE t, ITooltipFlag f) { t.add(new TranslationTextComponent("tooltip.steampowered.alternator").withStyle(TextFormatting.GRAY)); + if(Screen.hasShiftDown()) { + t.add(new TranslationTextComponent("tooltip.steampowered.alternator.thanks").withStyle(TextFormatting.GOLD)); + }else { + t.add(TooltipHelper.holdShift(Palette.Gray,false)); + } /*if (ModList.get().isLoaded("createaddition")) { if (SPConfig.SERVER.disableDynamo.get()) { t.add(new StringTextComponent("Dynamo is disabled in [save]/serverconfig/steampowered-server.toml").withStyle(TextFormatting.RED)); diff --git a/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerBlock.java b/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerBlock.java index c361fb6..142b306 100644 --- a/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerBlock.java @@ -20,9 +20,14 @@ package com.teammoeg.steampowered.content.boiler; import java.util.List; +import com.simibubi.create.foundation.item.ItemDescription.Palette; +import com.simibubi.create.foundation.item.TooltipHelper; +import com.teammoeg.steampowered.client.ClientUtils; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.ILiquidContainer; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; @@ -79,10 +84,17 @@ public abstract class BoilerBlock extends Block implements ILiquidContainer{ @Override public void appendHoverText(ItemStack i, IBlockReader w, List t, ITooltipFlag f) { - t.add(new TranslationTextComponent("tooltip.steampowered.boiler.danger").withStyle(TextFormatting.RED)); - t.add(new TranslationTextComponent("tooltip.steampowered.boiler.huconsume",this.getHuConsume()).withStyle(TextFormatting.GOLD)); - t.add(new TranslationTextComponent("tooltip.steampowered.boiler.waterconsume",this.getHuConsume()/120).withStyle(TextFormatting.AQUA)); - t.add(new TranslationTextComponent("tooltip.steampowered.boiler.steamproduce",this.getHuConsume()/10).withStyle(TextFormatting.GOLD)); + if(Screen.hasShiftDown()) { + t.add(new TranslationTextComponent("tooltip.steampowered.boiler.brief").withStyle(TextFormatting.GOLD)); + if(ClientUtils.hasGoggles()) { + t.add(new TranslationTextComponent("tooltip.steampowered.boiler.danger").withStyle(TextFormatting.RED)); + t.add(new TranslationTextComponent("tooltip.steampowered.boiler.huconsume",this.getHuConsume()).withStyle(TextFormatting.GOLD)); + t.add(new TranslationTextComponent("tooltip.steampowered.boiler.waterconsume",((int)Math.ceil(this.getHuConsume()/120.0))).withStyle(TextFormatting.AQUA)); + t.add(new TranslationTextComponent("tooltip.steampowered.boiler.steamproduce",this.getHuConsume()/10).withStyle(TextFormatting.GOLD)); + } + }else { + t.add(TooltipHelper.holdShift(Palette.Gray,false)); + } super.appendHoverText(i,w,t,f); } diff --git a/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerTileEntity.java b/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerTileEntity.java index ddad278..21ee2fa 100644 --- a/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerTileEntity.java +++ b/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerTileEntity.java @@ -43,14 +43,18 @@ import net.minecraftforge.fluids.capability.templates.FluidTank; import java.util.List; public abstract class BoilerTileEntity extends TileEntity implements IHeatReceiver, ITickableTileEntity, IHaveGoggleInformation { - FluidTank input = new FluidTank(10000) { - @Override - public boolean isFluidValid(FluidStack stack) { - return stack.getFluid() == Fluids.WATER; - } + FluidTank input = new FluidTank(10000,s->s.getFluid() == Fluids.WATER) { + + @Override + public FluidStack getFluid() { + return new FluidStack(Fluids.WATER,this.getFluidAmount()); + } }; FluidTank output = new FluidTank(10000) { - + @Override + public FluidStack getFluid() { + return new FluidStack(FluidRegistry.steam.get().getFluid(),this.getFluidAmount()); + } }; private IFluidHandler ft = new IFluidHandler() { @Override @@ -158,8 +162,8 @@ public abstract class BoilerTileEntity extends TileEntity implements IHeatReceiv if (this.level != null && !this.level.isClientSide) { int consume = Math.min(getHUPerTick(), heatreceived); heatreceived = 0; - int waterconsume=(int) (SPConfig.COMMON.steamPerWater.get()*10); - consume = Math.min(this.input.drain((int) Math.ceil(consume / waterconsume), FluidAction.EXECUTE).getAmount() * waterconsume, consume); + double waterconsume=(SPConfig.COMMON.steamPerWater.get()*10); + consume = Math.min((int)(this.input.drain((int) Math.ceil(consume / waterconsume), FluidAction.EXECUTE).getAmount() * waterconsume), consume); this.output.fill(new FluidStack(FluidRegistry.steam.get().getFluid(), consume / 10), FluidAction.EXECUTE); this.level.sendBlockUpdated(this.getBlockPos(),this.getBlockState(),this.getBlockState(), 3); diff --git a/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlock.java b/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlock.java index 2d48a7a..b474ecf 100644 --- a/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlock.java @@ -20,8 +20,13 @@ package com.teammoeg.steampowered.content.burner; import java.util.List; +import com.simibubi.create.foundation.item.TooltipHelper; +import com.simibubi.create.foundation.item.ItemDescription.Palette; +import com.teammoeg.steampowered.client.ClientUtils; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; @@ -80,9 +85,16 @@ public abstract class BurnerBlock extends Block { @Override public void appendHoverText(ItemStack i, IBlockReader w, List t, ITooltipFlag f) { - t.add(new TranslationTextComponent("tooltip.steampowered.burner.danger").withStyle(TextFormatting.RED)); - t.add(new TranslationTextComponent("tooltip.steampowered.burner.huproduce",this.getHuProduce()).withStyle(TextFormatting.GOLD)); + if(Screen.hasShiftDown()) { + t.add(new TranslationTextComponent("tooltip.steampowered.burner.brief").withStyle(TextFormatting.GOLD)); + if(ClientUtils.hasGoggles()) { + t.add(new TranslationTextComponent("tooltip.steampowered.burner.danger").withStyle(TextFormatting.RED)); + t.add(new TranslationTextComponent("tooltip.steampowered.burner.huproduce",this.getHuProduce()).withStyle(TextFormatting.GOLD)); + } + }else { + t.add(TooltipHelper.holdShift(Palette.Gray,false)); + } super.appendHoverText(i,w,t,f); } diff --git a/src/main/java/com/teammoeg/steampowered/content/engine/BronzeSteamEngineBlock.java b/src/main/java/com/teammoeg/steampowered/content/engine/BronzeSteamEngineBlock.java index 1c17cf7..9c4a106 100644 --- a/src/main/java/com/teammoeg/steampowered/content/engine/BronzeSteamEngineBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/engine/BronzeSteamEngineBlock.java @@ -18,10 +18,22 @@ package com.teammoeg.steampowered.content.engine; +import java.util.List; + import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.item.TooltipHelper; +import com.simibubi.create.foundation.item.ItemDescription.Palette; +import com.teammoeg.steampowered.SPConfig; +import com.teammoeg.steampowered.client.ClientUtils; import com.teammoeg.steampowered.registrate.SPTiles; import net.minecraft.block.BlockState; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.IBlockReader; public class BronzeSteamEngineBlock extends SteamEngineBlock implements ITE { @@ -38,4 +50,16 @@ public class BronzeSteamEngineBlock extends SteamEngineBlock implements ITE getTileEntityClass() { return BronzeSteamEngineTileEntity.class; } + @Override + public void appendHoverText(ItemStack i, IBlockReader w, List t, + ITooltipFlag f) { + if(Screen.hasShiftDown()) { + t.add(new TranslationTextComponent("tooltip.steampowered.engine.brief").withStyle(TextFormatting.GOLD)); + if(ClientUtils.hasGoggles()) + t.add(new TranslationTextComponent("tooltip.steampowered.engine.steamconsume",SPConfig.COMMON.bronzeFlywheelSteamConsumptionPerTick.get()).withStyle(TextFormatting.GOLD)); + }else { + t.add(TooltipHelper.holdShift(Palette.Gray,false)); + } + super.appendHoverText(i,w,t,f); + } } diff --git a/src/main/java/com/teammoeg/steampowered/content/engine/CastIronSteamEngineBlock.java b/src/main/java/com/teammoeg/steampowered/content/engine/CastIronSteamEngineBlock.java index dcc7d07..f19d74a 100644 --- a/src/main/java/com/teammoeg/steampowered/content/engine/CastIronSteamEngineBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/engine/CastIronSteamEngineBlock.java @@ -18,10 +18,22 @@ package com.teammoeg.steampowered.content.engine; +import java.util.List; + import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.item.TooltipHelper; +import com.simibubi.create.foundation.item.ItemDescription.Palette; +import com.teammoeg.steampowered.SPConfig; +import com.teammoeg.steampowered.client.ClientUtils; import com.teammoeg.steampowered.registrate.SPTiles; import net.minecraft.block.BlockState; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.IBlockReader; public class CastIronSteamEngineBlock extends SteamEngineBlock implements ITE { @@ -33,7 +45,18 @@ public class CastIronSteamEngineBlock extends SteamEngineBlock implements ITE t, + ITooltipFlag f) { + if(Screen.hasShiftDown()) { + t.add(new TranslationTextComponent("tooltip.steampowered.engine.brief").withStyle(TextFormatting.GOLD)); + if(ClientUtils.hasGoggles()) + t.add(new TranslationTextComponent("tooltip.steampowered.engine.steamconsume",SPConfig.COMMON.castIronFlywheelSteamConsumptionPerTick.get()).withStyle(TextFormatting.GOLD)); + }else { + t.add(TooltipHelper.holdShift(Palette.Gray,false)); + } + super.appendHoverText(i,w,t,f); + } @Override public Class getTileEntityClass() { return CastIronSteamEngineTileEntity.class; diff --git a/src/main/java/com/teammoeg/steampowered/content/engine/SteelSteamEngineBlock.java b/src/main/java/com/teammoeg/steampowered/content/engine/SteelSteamEngineBlock.java index 8504d45..0745e67 100644 --- a/src/main/java/com/teammoeg/steampowered/content/engine/SteelSteamEngineBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/engine/SteelSteamEngineBlock.java @@ -18,10 +18,22 @@ package com.teammoeg.steampowered.content.engine; +import java.util.List; + import com.simibubi.create.foundation.block.ITE; +import com.simibubi.create.foundation.item.TooltipHelper; +import com.simibubi.create.foundation.item.ItemDescription.Palette; +import com.teammoeg.steampowered.SPConfig; +import com.teammoeg.steampowered.client.ClientUtils; import com.teammoeg.steampowered.registrate.SPTiles; import net.minecraft.block.BlockState; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.IBlockReader; public class SteelSteamEngineBlock extends SteamEngineBlock implements ITE { @@ -33,7 +45,18 @@ public class SteelSteamEngineBlock extends SteamEngineBlock implements ITE t, + ITooltipFlag f) { + if(Screen.hasShiftDown()) { + t.add(new TranslationTextComponent("tooltip.steampowered.engine.brief").withStyle(TextFormatting.GOLD)); + if(ClientUtils.hasGoggles()) + t.add(new TranslationTextComponent("tooltip.steampowered.engine.steamconsume",SPConfig.COMMON.steelFlywheelSteamConsumptionPerTick.get()).withStyle(TextFormatting.GOLD)); + }else { + t.add(TooltipHelper.holdShift(Palette.Gray,false)); + } + super.appendHoverText(i,w,t,f); + } @Override public Class getTileEntityClass() { return SteelSteamEngineTileEntity.class; diff --git a/src/main/resources/assets/steampowered/lang/en_us.json b/src/main/resources/assets/steampowered/lang/en_us.json index a555dee..80900ec 100644 --- a/src/main/resources/assets/steampowered/lang/en_us.json +++ b/src/main/resources/assets/steampowered/lang/en_us.json @@ -43,6 +43,7 @@ "block.steampowered.alternator": "Alternating Dynamo", "tooltip.steampowered.alternator": "Not same as CC&A!", + "tooltip.steampowered.alternator.thanks": "Thanks to MRH0 For his wonderful works!", "steampowered.ponder.dynamo.header": "Generating Electric energy using a Dynamo", "steampowered.ponder.dynamo.text_1": "The Dynamo generates electric energy (FE) from rotational force", @@ -58,11 +59,16 @@ "tooltip.steampowered.burner.item" : "Fuel Remaining: %s x %s", "tooltip.steampowered.burner.huproduce" : "Generates %s HU/t", "tooltip.steampowered.burner.danger": "Caution! Standing on when burning causes damage!", + "tooltip.steampowered.burner.brief": "Generate heat by burning fuel.", "tooltip.steampowered.boiler.huconsume" : "Maximum Heat Intake %s HU/t", "tooltip.steampowered.boiler.waterconsume" : "Requires Water %s mb/t", "tooltip.steampowered.boiler.steamproduce" : "Maximum Steam Output %s mb/t", "tooltip.steampowered.boiler.danger": "Caution! Standing on when working causes damage!", + "tooltip.steampowered.boiler.brief": "Generate steam by heating water.", + + "tooltip.steampowered.engine.steamconsume": "Requires %s mb/t of Steam", + "tooltip.steampowered.engine.brief": "Generate kinetic force with steam.", "steampowered.ponder.boiler.header": "Generating Steam through Boilers and Burning Chambers", "steampowered.ponder.boiler.text_1": "The Boiler needs water to produce Steam", diff --git a/src/main/resources/assets/steampowered/lang/ja_jp.json b/src/main/resources/assets/steampowered/lang/ja_jp.json index bd05ac6..95bf681 100644 --- a/src/main/resources/assets/steampowered/lang/ja_jp.json +++ b/src/main/resources/assets/steampowered/lang/ja_jp.json @@ -43,6 +43,7 @@ "block.steampowered.alternator": "オルタネーター Dynamo", "tooltip.steampowered.alternator":"Not same as CC&A!", + "tooltip.steampowered.alternator.thanks": "Thanks to MRH0 For his wonderful works!", "steampowered.ponder.dynamo.header": "オルタネーターによる発電", "steampowered.ponder.dynamo.text_1": "回転力で電気(FE)を発電します", @@ -58,11 +59,16 @@ "tooltip.steampowered.burner.item": "Fuel Remaining: %s x %s", "tooltip.steampowered.burner.huproduce": "Generates %s HU/t", "tooltip.steampowered.burner.danger": "Caution! Standing on when burning causes damage!", + "tooltip.steampowered.burner.brief": "Generate heat by burning fuel.", "tooltip.steampowered.boiler.huconsume": "Maximum Heat Intake %s HU/t", "tooltip.steampowered.boiler.waterconsume": "Requires Water %s mb/t", "tooltip.steampowered.boiler.steamproduce": "Maximum Steam Output %s mb/t", "tooltip.steampowered.boiler.danger": "Caution! Standing on when working causes damage!", + "tooltip.steampowered.boiler.brief": "Generate steam by heating water.", + + "tooltip.steampowered.engine.steamconsume": "Requires %s mb/t of Steam", + "tooltip.steampowered.engine.brief": "Generate kinetic force with steam.", "steampowered.ponder.boiler.header": "Generating Steam through Boilers and Burning Chambers", "steampowered.ponder.boiler.text_1": "The Boiler needs water to produce Steam", diff --git a/src/main/resources/assets/steampowered/lang/zh_cn.json b/src/main/resources/assets/steampowered/lang/zh_cn.json index 8bf2cae..580df7d 100644 --- a/src/main/resources/assets/steampowered/lang/zh_cn.json +++ b/src/main/resources/assets/steampowered/lang/zh_cn.json @@ -43,6 +43,7 @@ "block.steampowered.alternator": "交流式发电机", "tooltip.steampowered.alternator": "另一个旋转动力发电机", + "tooltip.steampowered.alternator.thanks": "感谢MRH0的启发性工作", "steampowered.ponder.dynamo.header": "使用发电机发电", "steampowered.ponder.dynamo.text_1": "发电机从旋转动力中产生电能(FE)", @@ -58,11 +59,16 @@ "tooltip.steampowered.burner.item" : "燃料: %s x %s", "tooltip.steampowered.burner.huproduce" : "产生%s HU/t", "tooltip.steampowered.burner.danger": "工作时站在上面会受伤!", + "tooltip.steampowered.burner.brief": "燃烧燃料发热", "tooltip.steampowered.boiler.huconsume" : "最大消耗 %s HU/t", "tooltip.steampowered.boiler.waterconsume" : "使用水 %s mb/t", "tooltip.steampowered.boiler.steamproduce" : "最大蒸汽产出 %s mb/t", "tooltip.steampowered.boiler.danger": "工作时站在上面会受伤!", + "tooltip.steampowered.boiler.brief": "加热水以获得蒸汽", + + "tooltip.steampowered.engine.steamconsume": "需要蒸汽%s mb/t", + "tooltip.steampowered.engine.brief": "消耗蒸汽产生动力", "steampowered.ponder.boiler.header": "通过锅炉和燃烧室产生蒸汽", "steampowered.ponder.boiler.text_1": "锅炉需要水以产生蒸汽",