Skip to content

Commit

Permalink
Add terrain resist tooltips to multiblocks (#2620)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCTian-mi authored Jan 6, 2025
1 parent 3e35cc9 commit 9646d3a
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ public void addDebugInfo(List<String> list) {}

@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, @NotNull List<String> tooltip,
boolean advanced) {}
boolean advanced) {
if (ConfigHolder.machines.doTerrainExplosion && getIsWeatherOrTerrainResistant())
tooltip.add(I18n.format("gregtech.universal.tooltip.terrain_resist"));
}

/**
* Override this to add extended tool information to the "Hold SHIFT to show Tool Info" tooltip section.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@
import gregtech.api.util.GTUtility;
import gregtech.client.renderer.texture.Textures;
import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer;
import gregtech.common.ConfigHolder;

import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

Expand All @@ -23,10 +19,6 @@
import codechicken.lib.vec.Matrix4;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public abstract class TieredMetaTileEntity extends MetaTileEntity
implements IEnergyChangeListener, ITieredMetaTileEntity {
Expand Down Expand Up @@ -57,14 +49,6 @@ protected SimpleSidedCubeRenderer getBaseRenderer() {
return Textures.VOLTAGE_CASINGS[tier];
}

@Override
public void addInformation(ItemStack stack, @Nullable World player, @NotNull List<String> tooltip,
boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
if (ConfigHolder.machines.doTerrainExplosion && getIsWeatherOrTerrainResistant())
tooltip.add(I18n.format("gregtech.universal.tooltip.terrain_resist"));
}

@Override
@SideOnly(Side.CLIENT)
public Pair<TextureAtlasSprite, Integer> getParticleTexture() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ public boolean getIsWeatherOrTerrainResistant() {

@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(I18n.format("gregtech.machine.block_breaker.tooltip"));
tooltip.add(I18n.format("gregtech.universal.tooltip.uses_per_op", getEnergyPerBlockBreak()));
tooltip.add(I18n.format("gregtech.universal.tooltip.voltage_in", energyContainer.getInputVoltage(),
Expand All @@ -279,7 +280,6 @@ public void addInformation(ItemStack stack, @Nullable World player, List<String>
tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize()));
tooltip.add(I18n.format("gregtech.machine.block_breaker.speed_bonus", (int) (getEfficiencyMultiplier() * 100)));
tooltip.add(I18n.format("gregtech.universal.tooltip.requires_redstone"));
super.addInformation(stack, player, tooltip, advanced);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation,

@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(I18n.format("gregtech.machine.fisher.tooltip"));
tooltip.add(I18n.format("gregtech.machine.fisher.speed", fishingTicks));
tooltip.add(I18n.format("gregtech.machine.fisher.requirement", (int) Math.sqrt(WATER_CHECK_SIZE),
Expand All @@ -150,7 +151,6 @@ public void addInformation(ItemStack stack, @Nullable World player, List<String>
GTValues.VNF[getTier()]));
tooltip.add(
I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity()));
super.addInformation(stack, player, tooltip, advanced);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.util.GTUtility;
import gregtech.client.renderer.texture.Textures;
import gregtech.common.ConfigHolder;

import net.minecraft.block.BlockLiquid;
import net.minecraft.block.state.IBlockState;
Expand Down Expand Up @@ -398,9 +397,8 @@ public void readFromNBT(NBTTagCompound data) {

@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(I18n.format("gregtech.machine.pump.tooltip"));
if (ConfigHolder.machines.doTerrainExplosion)
tooltip.add(I18n.format("gregtech.universal.tooltip.terrain_resist"));
tooltip.add(
I18n.format("gregtech.universal.tooltip.uses_per_op", GTValues.V[getTier()] * 2) + TextFormatting.GRAY +
", " + I18n.format("gregtech.machine.pump.tooltip_buckets", getPumpingCycleLength()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import gregtech.api.pipenet.longdist.ILDEndpoint;
import gregtech.api.pipenet.longdist.LongDistanceNetwork;
import gregtech.api.pipenet.longdist.LongDistancePipeType;
import gregtech.common.ConfigHolder;

import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
Expand Down Expand Up @@ -213,15 +212,13 @@ protected boolean openGUIOnRightClick() {
@Override
public void addInformation(ItemStack stack, @Nullable World player, @NotNull List<String> tooltip,
boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.1"));
tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.2"));
tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.3"));
if (pipeType.getMinLength() > 0) {
tooltip.add(I18n.format("gregtech.machine.endpoint.tooltip.min_length", pipeType.getMinLength()));
}
if (ConfigHolder.machines.doTerrainExplosion && getIsWeatherOrTerrainResistant()) {
tooltip.add(I18n.format("gregtech.universal.tooltip.terrain_resist"));
}
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -5420,7 +5420,7 @@ gregtech.universal.tooltip.uses_per_op=Uses §f%,d EU/operation
gregtech.universal.tooltip.base_production_eut=§eBase Production: §f%,d EU/t
gregtech.universal.tooltip.base_production_fluid=§eBase Production: §f%,d L/t
gregtech.universal.tooltip.produces_fluid=§eProduces: §f%,d L/t
gregtech.universal.tooltip.terrain_resist=This Machine will not explode when exposed to the Elements
gregtech.universal.tooltip.terrain_resist=§eThis Machine will not explode when exposed to the Elements
gregtech.universal.tooltip.requires_redstone=§4Requires Redstone power

gregtech.block.tooltip.no_mob_spawning=§bMobs cannot spawn on this block
Expand Down

0 comments on commit 9646d3a

Please sign in to comment.