Even more client/server cleanup.

This commit is contained in:
modmuss50 2022-03-02 14:32:52 +00:00
parent 9c390e40a5
commit 612657ecf4
20 changed files with 28 additions and 117 deletions

View file

@ -25,16 +25,12 @@
package techreborn.blockentity.machine.tier3;
import net.minecraft.block.BlockState;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
import reborncore.api.IListInfoProvider;
import reborncore.common.screen.BuiltScreenHandlerProvider;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.client.screen.builder.ScreenHandlerBuilder;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.screen.BuiltScreenHandlerProvider;
import reborncore.common.util.ItemUtils;
import reborncore.common.util.RebornInventory;
import techreborn.blockentity.machine.GenericMachineBlockEntity;
@ -44,10 +40,7 @@ import techreborn.init.TRBlockEntities;
import techreborn.init.TRContent;
import techreborn.items.DynamicCellItem;
import java.util.List;
public class IndustrialCentrifugeBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider, IListInfoProvider {
public class IndustrialCentrifugeBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider {
public IndustrialCentrifugeBlockEntity(BlockPos pos, BlockState state) {
super(TRBlockEntities.INDUSTRIAL_CENTRIFUGE, pos, state, "IndustrialCentrifuge", TechRebornConfig.industrialCentrifugeMaxInput, TechRebornConfig.industrialCentrifugeMaxEnergy, TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block, 6);
final int[] inputs = new int[]{0, 1};
@ -67,13 +60,4 @@ public class IndustrialCentrifugeBlockEntity extends GenericMachineBlockEntity i
.outputSlot(4, 120, 44).outputSlot(5, 101, 63).energySlot(6, 8, 72).syncEnergyValue()
.syncCrafterValue().addInventory().create(this, syncID);
}
// IListInfoProvider
@Override
public void addInfo(final List<Text> info, final boolean isReal, boolean hasData) {
super.addInfo(info, isReal, hasData);
if (Screen.hasControlDown()) {
info.add(new LiteralText("Round and round it goes"));
}
}
}

View file

@ -24,8 +24,6 @@
package techreborn.blocks.generator;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -81,7 +79,6 @@ public class BlockFusionCoil extends Block {
return ActionResult.PASS;
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Text> tooltip, TooltipContext flagIn) {
super.appendTooltip(stack, worldIn, tooltip, flagIn);

View file

@ -24,8 +24,6 @@
package techreborn.blocks.machine.tier0;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
@ -33,9 +31,9 @@ import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import techreborn.blockentity.GuiType;
import techreborn.blockentity.machine.iron.IronAlloyFurnaceBlockEntity;
import techreborn.blocks.GenericMachineBlock;
import techreborn.blockentity.GuiType;
import java.util.Random;
@ -46,7 +44,6 @@ public class IronAlloyFurnaceBlock extends GenericMachineBlock {
}
// Block
@Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (!isActive(stateIn)) {
return;

View file

@ -24,8 +24,6 @@
package techreborn.blocks.machine.tier0;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
@ -33,9 +31,9 @@ import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import techreborn.blockentity.GuiType;
import techreborn.blockentity.machine.iron.IronFurnaceBlockEntity;
import techreborn.blocks.GenericMachineBlock;
import techreborn.blockentity.GuiType;
import java.util.Random;
@ -46,7 +44,6 @@ public class IronFurnaceBlock extends GenericMachineBlock {
}
// Block
@Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (!isActive(stateIn)) {
return;

View file

@ -33,6 +33,7 @@ import net.minecraft.block.Block;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.fluid.FlowableFluid;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
@ -103,6 +104,18 @@ public class StackToolTipHandler implements ItemTooltipCallback {
ToolTipAssistUtils.addInfo("unplaceable_fluid", tooltipLines, false);
}
if (item == TRContent.Upgrades.SUPERCONDUCTOR.item && Screen.hasControlDown()) {
tooltipLines.add(new LiteralText(Formatting.GOLD + "Blame obstinate_3 for this"));
}
if (item == TRContent.OMNI_TOOL) {
tooltipLines.add(new LiteralText(Formatting.YELLOW + I18n.translate("techreborn.tooltip.omnitool_motto")));
}
if (block == TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block && Screen.hasControlDown()) {
tooltipLines.add(new LiteralText("Round and round it goes"));
}
if (UNOBTAINABLE_ORES.contains(block)) {
tooltipLines.add(new TranslatableText("techreborn.tooltip.unobtainable").formatted(Formatting.AQUA));
} else if (OreDepthSyncHandler.getOreDepthMap().containsKey(block)) {

View file

@ -24,8 +24,6 @@
package techreborn.items;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
@ -39,7 +37,6 @@ import net.minecraft.util.TypedActionResult;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
@ -85,7 +82,6 @@ public class BatteryItem extends Item implements RcEnergyItem {
}
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
ItemUtils.buildActiveTooltip(stack, tooltip);

View file

@ -24,8 +24,6 @@
package techreborn.items;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
@ -114,7 +112,6 @@ public class FrequencyTransmitterItem extends Item {
return new TypedActionResult<>(ActionResult.SUCCESS, stack);
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
getPos(stack)

View file

@ -24,25 +24,14 @@
package techreborn.items;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import reborncore.api.blockentity.IUpgrade;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.recipes.IUpgradeHandler;
import techreborn.TechReborn;
import techreborn.init.TRContent;
import java.util.List;
public class UpgradeItem extends Item implements IUpgrade {
@ -64,14 +53,4 @@ public class UpgradeItem extends Item implements IUpgrade {
ItemStack stack) {
behavior.process(blockEntity, handler, stack);
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
if (stack.getItem() == TRContent.Upgrades.SUPERCONDUCTOR.item) {
if (Screen.hasControlDown()) {
tooltip.add(new LiteralText(Formatting.GOLD + "Blame obstinate_3 for this"));
}
}
}
}

View file

@ -24,8 +24,6 @@
package techreborn.items.armor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
@ -35,7 +33,6 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
@ -74,7 +71,6 @@ public class BatpackItem extends ArmorItem implements RcEnergyItem {
return true;
}
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) {

View file

@ -24,8 +24,6 @@
package techreborn.items.armor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
@ -35,8 +33,8 @@ import net.minecraft.util.collection.DefaultedList;
import reborncore.api.items.ArmorBlockEntityTicker;
import reborncore.api.items.ArmorRemoveHandler;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.util.ItemUtils;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRArmorMaterials;
@ -80,7 +78,6 @@ public class CloakingDeviceItem extends TRArmourItem implements RcEnergyItem, Ar
}
// Item
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) {

View file

@ -26,8 +26,6 @@ package techreborn.items.armor;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.attribute.EntityAttribute;
import net.minecraft.entity.attribute.EntityAttributeModifier;
@ -43,7 +41,6 @@ import net.minecraft.util.collection.DefaultedList;
import reborncore.api.items.ArmorBlockEntityTicker;
import reborncore.api.items.ArmorRemoveHandler;
import reborncore.api.items.ItemStackModifiers;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
@ -177,7 +174,6 @@ public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers,
return RcEnergyTier.EXTREME;
}
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> itemList) {
if (!isIn(group)) {

View file

@ -24,8 +24,6 @@
package techreborn.items.tool;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.item.TooltipContext;
@ -96,7 +94,6 @@ public class PaintingToolItem extends Item {
return null;
}
@Environment(EnvType.CLIENT)
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
BlockState blockState = getCover(stack);
if (blockState != null) {

View file

@ -101,7 +101,6 @@ public class AdvancedJackhammerItem extends JackhammerItem implements MultiBlock
ItemUtils.checkActive(stack, cost, MessageIDs.poweredToolID, entity);
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
ItemUtils.buildActiveTooltip(stack, tooltip);

View file

@ -24,13 +24,10 @@
package techreborn.items.tool.basic;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
@ -57,7 +54,6 @@ public class ElectricTreetapItem extends Item implements RcEnergyItem {
return false;
}
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
if (!isIn(group)) {

View file

@ -24,8 +24,6 @@
package techreborn.items.tool.basic;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
@ -36,8 +34,8 @@ import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.util.ItemUtils;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
@ -110,7 +108,6 @@ public class RockCutterItem extends PickaxeItem implements RcEnergyItem {
return true;
}
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> stacks) {
if (!isIn(group)) {

View file

@ -24,8 +24,6 @@
package techreborn.items.tool.industrial;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.LivingEntity;
@ -41,8 +39,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.common.util.ItemUtils;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRToolMaterials;
import techreborn.items.tool.ChainsawItem;
@ -119,7 +117,6 @@ public class IndustrialChainsawItem extends ChainsawItem {
ItemUtils.checkActive(stack, cost, MessageIDs.poweredToolID, entity);
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
ItemUtils.buildActiveTooltip(stack, tooltip);

View file

@ -24,8 +24,6 @@
package techreborn.items.tool.industrial;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.client.item.TooltipContext;
@ -33,7 +31,6 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterials;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
@ -42,8 +39,8 @@ import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.common.util.ItemUtils;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
import techreborn.init.TRToolMaterials;
@ -114,13 +111,11 @@ public class IndustrialDrillItem extends DrillItem {
ItemUtils.checkActive(stack, cost, MessageIDs.poweredToolID, entity);
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
ItemUtils.buildActiveTooltip(stack, tooltip);
}
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {

View file

@ -24,8 +24,6 @@
package techreborn.items.tool.industrial;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.Entity;
@ -44,9 +42,9 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.common.misc.MultiBlockBreakingTool;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ChatUtils;
import reborncore.common.util.ItemUtils;
import reborncore.common.powerSystem.RcEnergyTier;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRToolMaterials;
import techreborn.items.tool.JackhammerItem;
@ -146,7 +144,6 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
ItemUtils.checkActive(stack, cost, MessageIDs.poweredToolID, entity);
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
ItemUtils.buildActiveTooltip(stack, tooltip);

View file

@ -35,7 +35,10 @@ import net.minecraft.entity.attribute.EntityAttribute;
import net.minecraft.entity.attribute.EntityAttributeModifier;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
@ -45,10 +48,9 @@ import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.api.items.ItemStackModifiers;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.util.ItemUtils;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
import techreborn.config.TechRebornConfig;
import techreborn.init.TRContent;
@ -104,7 +106,6 @@ public class NanosaberItem extends SwordItem implements RcEnergyItem, ItemStackM
return true;
}
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(
ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {

View file

@ -24,27 +24,19 @@
package techreborn.items.tool.industrial;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*;
import net.minecraft.tag.TagKey;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.common.powerSystem.RcEnergyItem;
import reborncore.common.powerSystem.RcEnergyTier;
import reborncore.common.util.ItemUtils;
@ -56,8 +48,6 @@ import techreborn.init.TRToolMaterials;
import techreborn.items.tool.MiningLevel;
import techreborn.utils.InitUtils;
import java.util.List;
public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
public static final TagKey<Block> OMNI_TOOL_MINEABLE = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "mineable/omni_tool"));
@ -125,7 +115,6 @@ public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
return true;
}
@Environment(EnvType.CLIENT)
@Override
public void appendStacks(ItemGroup par2ItemGroup, DefaultedList<ItemStack> itemList) {
if (!isIn(par2ItemGroup)) {
@ -134,12 +123,6 @@ public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
InitUtils.initPoweredItems(TRContent.OMNI_TOOL, itemList);
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
tooltip.add(new LiteralText(Formatting.YELLOW + I18n.translate("techreborn.tooltip.omnitool_motto")));
}
@Override
public int getItemBarStep(ItemStack stack) {
return ItemUtils.getPowerForDurabilityBar(stack);