From 3ea07b3ef8421180ed8404cde41a947e3b1bff9f Mon Sep 17 00:00:00 2001 From: strubium <113206902+strubium@users.noreply.github.com> Date: Wed, 29 May 2024 13:13:04 -0500 Subject: [PATCH] More @SideOnly(Side.CLIENT) --- .../apiimpl/providers/CropInfoProvider.java | 57 ------------------- .../theoneprobe/config/TopModGuiFactory.java | 4 +- .../java/mcjty/theoneprobe/gui/HitBox.java | 4 ++ .../java/mcjty/theoneprobe/gui/Preset.java | 5 +- .../rendering/OverlayRenderer.java | 3 - .../assets/theoneprobe/lang/fr_fr.lang | 50 +++++++++++++++- .../theoneprobe/recipes/probegoggles.json | 2 +- 7 files changed, 59 insertions(+), 66 deletions(-) diff --git a/src/main/java/mcjty/theoneprobe/apiimpl/providers/CropInfoProvider.java b/src/main/java/mcjty/theoneprobe/apiimpl/providers/CropInfoProvider.java index 7e2d7db7..6f5419f6 100644 --- a/src/main/java/mcjty/theoneprobe/apiimpl/providers/CropInfoProvider.java +++ b/src/main/java/mcjty/theoneprobe/apiimpl/providers/CropInfoProvider.java @@ -1,58 +1 @@ -package mcjty.theoneprobe.apiimpl.providers; - -import mcjty.theoneprobe.api.*; -import mcjty.theoneprobe.Utilities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockCocoa; -import net.minecraft.block.BlockStem; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; import net.minecraft.world.World; - -import javax.annotation.Nonnull; -import java.util.Collections; - -public class CropInfoProvider implements IProbeInfoProvider { - - private static final ItemStack PUMPKIN = new ItemStack(Blocks.PUMPKIN); - private static final ItemStack MELON = new ItemStack(Blocks.MELON_BLOCK); - private static final ItemStack COCOA = new ItemStack(Items.DYE, 1, 3); - - @Override - public String getID() { - return Utilities.getProviderId("crop"); - } - - @Override - public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, @Nonnull IBlockState blockState, IProbeHitData data) { - Block block = blockState.getBlock(); - if (block instanceof BlockStem || block instanceof BlockCocoa) { - for (IProperty property : blockState.getProperties().keySet()) { - if (!"age".equals(property.getName())) continue; - if (property.getValueClass() == Integer.class) { - //noinspection unchecked - IProperty integerProperty = (IProperty) property; - int age = blockState.getValue(integerProperty); - int maxAge = Collections.max(integerProperty.getAllowedValues()); - - IProbeInfo horizontalPane = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)); - if (block == Blocks.PUMPKIN_STEM) horizontalPane.item(PUMPKIN); - else if (block == Blocks.MELON_STEM) horizontalPane.item(MELON); - else if (block == Blocks.COCOA) horizontalPane.item(COCOA); - - if (age == maxAge) { - horizontalPane.text(TextStyleClass.OK + "{*topextras.top.growth_finished*}"); - } else { - horizontalPane.text(TextStyleClass.LABEL + "{*topextras.top.growth*} " + TextStyleClass.WARNING + (age * 100 / maxAge) + "%"); - } - return; - } - return; - } - } - } -} diff --git a/src/main/java/mcjty/theoneprobe/config/TopModGuiFactory.java b/src/main/java/mcjty/theoneprobe/config/TopModGuiFactory.java index 63e73fe8..5f574647 100644 --- a/src/main/java/mcjty/theoneprobe/config/TopModGuiFactory.java +++ b/src/main/java/mcjty/theoneprobe/config/TopModGuiFactory.java @@ -3,9 +3,11 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.fml.client.IModGuiFactory; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import java.util.Set; - +@SideOnly(Side.CLIENT) public class TopModGuiFactory implements IModGuiFactory { @Override diff --git a/src/main/java/mcjty/theoneprobe/gui/HitBox.java b/src/main/java/mcjty/theoneprobe/gui/HitBox.java index cd7b8639..21b9936d 100644 --- a/src/main/java/mcjty/theoneprobe/gui/HitBox.java +++ b/src/main/java/mcjty/theoneprobe/gui/HitBox.java @@ -1,5 +1,9 @@ package mcjty.theoneprobe.gui; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) class HitBox { private final int x1; private final int y1; diff --git a/src/main/java/mcjty/theoneprobe/gui/Preset.java b/src/main/java/mcjty/theoneprobe/gui/Preset.java index dfbbbe6b..53962f9d 100644 --- a/src/main/java/mcjty/theoneprobe/gui/Preset.java +++ b/src/main/java/mcjty/theoneprobe/gui/Preset.java @@ -2,10 +2,11 @@ import mcjty.theoneprobe.api.TextStyleClass; import org.apache.commons.lang3.tuple.Pair; - +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import java.util.HashMap; import java.util.Map; - +@SideOnly(Side.CLIENT) class Preset { private final String name; private final int boxBorderColor; diff --git a/src/main/java/mcjty/theoneprobe/rendering/OverlayRenderer.java b/src/main/java/mcjty/theoneprobe/rendering/OverlayRenderer.java index 6565c65a..7068a927 100644 --- a/src/main/java/mcjty/theoneprobe/rendering/OverlayRenderer.java +++ b/src/main/java/mcjty/theoneprobe/rendering/OverlayRenderer.java @@ -32,8 +32,6 @@ import net.minecraft.world.World; import org.apache.commons.lang3.tuple.Pair; import org.lwjgl.opengl.GL11; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; import java.util.HashMap; @@ -41,7 +39,6 @@ import java.util.UUID; import static mcjty.theoneprobe.api.TextStyleClass.ERROR; -@SideOnly(Side.CLIENT) public class OverlayRenderer { private static Map, Pair> cachedInfo = new HashMap<>(); diff --git a/src/main/resources/assets/theoneprobe/lang/fr_fr.lang b/src/main/resources/assets/theoneprobe/lang/fr_fr.lang index 4aad836c..52ff6157 100644 --- a/src/main/resources/assets/theoneprobe/lang/fr_fr.lang +++ b/src/main/resources/assets/theoneprobe/lang/fr_fr.lang @@ -7,6 +7,52 @@ item.theoneprobe.diamond_helmet_probe.name=Casque en diamant avec Sonde item.theoneprobe.gold_helmet_probe.name=Casque en or avec Sonde item.theoneprobe.iron_helmet_probe.name=Casque en fer avec Sonde item.theoneprobe.creativeprobe.name=La Sonde créative -item.theoneprobe.probenote.name=The One Probe: à lire -itemGroup.Probe=La Sonde +theoneprobe.probe.harvestable_indicator=Harvestable +theoneprobe.probe.not_harvestable_indicator=Not Harvestable +theoneprobe.probe.notool_indicator=No Tool +theoneprobe.probe.empty_indicator=Empty +theoneprobe.probe.bottle_indicator=Bottle +theoneprobe.probe.bottles_indicator=Bottles +theoneprobe.probe.enchanting_power_indicator=Enchanting Power: +theoneprobe.probe.tnt_fuse_indicator=TNT Fuse: +theoneprobe.probe.fuel_indicator=Fuel: +theoneprobe.probe.power_indicator=Power: +theoneprobe.probe.time_indicator=Time: +theoneprobe.probe.error_indicator=Error: +theoneprobe.probe.tool_indicator=Tool: +theoneprobe.probe.growing_time_indicator=Growing Time: +theoneprobe.probe.health_indicator=Health: +theoneprobe.probe.rotation_indicator=Rotation: +theoneprobe.probe.unknown_owner_indicator=Unknown owner +theoneprobe.probe.owned_by_indicator=Owned by: +theoneprobe.probe.jump_height_indicator=Jump height: +theoneprobe.probe.speed_indicator=Speed: +theoneprobe.probe.playing_indicator=Playing: +theoneprobe.probe.collar_color_indicator=Collar Color: + +config.theoneprobe.config.title=The One Probe Config + +gui.theoneprobe.gui_note.title=Things you should know about §6The One Probe +gui.theoneprobe.gui_note.body.1=§lThis mod can show a tooltip on screen +gui.theoneprobe.gui_note.body.2=§lwhen you look at a block or an entity +gui.theoneprobe.gui_note.needed.1=In this pack the probe is configured to be +gui.theoneprobe.gui_note.needed.2=required in order to see the tooltip +gui.theoneprobe.gui_note.not_needed.1=In this pack the probe is configured to be not +gui.theoneprobe.gui_note.not_needed.2=required in order to see the tooltip +gui.theoneprobe.gui_note.needed_for_extended.1=In this pack the probe is configured to be +gui.theoneprobe.gui_note.needed_for_extended.2=required to see extended information (when +gui.theoneprobe.gui_note.needed_for_extended.3=sneaking) but not for basic information +gui.theoneprobe.gui_note.needed_hard.1=In this pack the probe is configured to be +gui.theoneprobe.gui_note.needed_hard.2=required in order to see the tooltip +gui.theoneprobe.gui_note.needed_hard.3=This is set server side +gui.theoneprobe.gui_note.tail.1=Check out the 'Mod Options... for many client' +gui.theoneprobe.gui_note.tail.2=side configuration settings or sneak-right click +gui.theoneprobe.gui_note.tail.3=this note for more user-friendly setup +gui.theoneprobe.gui_note.button.title=§l§aYou can change this here: +gui.theoneprobe.gui_note.button.needed=Needed +gui.theoneprobe.gui_note.button.not_needed=Not needed +gui.theoneprobe.gui_note.button.extended=Extended + +item.theoneprobe.probenote.name=The One Probe: à lire +itemGroup.Probe=La Sonde \ No newline at end of file diff --git a/src/main/resources/assets/theoneprobe/recipes/probegoggles.json b/src/main/resources/assets/theoneprobe/recipes/probegoggles.json index 8e37e352..4665b226 100644 --- a/src/main/resources/assets/theoneprobe/recipes/probegoggles.json +++ b/src/main/resources/assets/theoneprobe/recipes/probegoggles.json @@ -1,4 +1,4 @@ -{ + { "conditions": [ { "type": "forge:mod_loaded",