Replace MixinItemRenderer by the new 1.17 vanilla API. Fixes #2602
This commit is contained in:
parent
f500b5ddff
commit
8b24b8439a
16 changed files with 72 additions and 204 deletions
|
@ -42,7 +42,6 @@ import org.jetbrains.annotations.Nullable;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
@ -50,7 +49,7 @@ import techreborn.utils.MessageIDs;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class BatteryItem extends Item implements RcEnergyItem, ItemDurabilityExtensions {
|
||||
public class BatteryItem extends Item implements RcEnergyItem {
|
||||
|
||||
private final int maxEnergy;
|
||||
private final RcEnergyTier tier;
|
||||
|
@ -113,17 +112,17 @@ public class BatteryItem extends Item implements RcEnergyItem, ItemDurabilityExt
|
|||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,12 +38,11 @@ import net.minecraft.world.World;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class BatpackItem extends ArmorItem implements RcEnergyItem, ItemDurabilityExtensions {
|
||||
public class BatpackItem extends ArmorItem implements RcEnergyItem {
|
||||
|
||||
public final int maxCharge;
|
||||
public final RcEnergyTier tier;
|
||||
|
@ -95,19 +94,18 @@ public class BatpackItem extends ArmorItem implements RcEnergyItem, ItemDurabili
|
|||
return tier;
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,12 +61,12 @@ public class CloakingDeviceItem extends TRArmourItem implements RcEnergyItem, Ar
|
|||
|
||||
// ItemTRArmour
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,8 @@ public class CloakingDeviceItem extends TRArmourItem implements RcEnergyItem, Ar
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
// Item
|
||||
|
|
|
@ -143,12 +143,12 @@ public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers,
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -158,8 +158,8 @@ public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers,
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,6 @@ import net.minecraft.entity.EquipmentSlot;
|
|||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.ArmorMaterial;
|
||||
import net.minecraft.item.Item;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import techreborn.TechReborn;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -36,7 +35,7 @@ import java.util.UUID;
|
|||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
*/
|
||||
public class TRArmourItem extends ArmorItem implements ItemDurabilityExtensions {
|
||||
public class TRArmourItem extends ArmorItem {
|
||||
|
||||
//Thanks for being private
|
||||
public static final UUID[] MODIFIERS = new UUID[]{
|
||||
|
|
|
@ -36,14 +36,13 @@ import net.minecraft.world.World;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ChainsawItem extends AxeItem implements RcEnergyItem, ItemDurabilityExtensions {
|
||||
public class ChainsawItem extends AxeItem implements RcEnergyItem {
|
||||
|
||||
public final int maxCharge;
|
||||
public final int cost;
|
||||
|
@ -118,20 +117,19 @@ public class ChainsawItem extends AxeItem implements RcEnergyItem, ItemDurabilit
|
|||
return referenceTool.isSuitableFor(state);
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
|
|
|
@ -38,12 +38,11 @@ import net.minecraft.world.World;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class DrillItem extends PickaxeItem implements RcEnergyItem, ItemDurabilityExtensions, DynamicAttributeTool {
|
||||
public class DrillItem extends PickaxeItem implements RcEnergyItem, DynamicAttributeTool {
|
||||
|
||||
public final int maxCharge;
|
||||
public final int cost;
|
||||
|
@ -133,20 +132,19 @@ public class DrillItem extends PickaxeItem implements RcEnergyItem, ItemDurabili
|
|||
InitUtils.initPoweredItems(this, stacks);
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
|
|
|
@ -39,7 +39,6 @@ import net.minecraft.world.World;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
@ -47,7 +46,7 @@ import techreborn.utils.ToolsUtil;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
public class JackhammerItem extends PickaxeItem implements RcEnergyItem, ItemDurabilityExtensions, DynamicAttributeTool {
|
||||
public class JackhammerItem extends PickaxeItem implements RcEnergyItem, DynamicAttributeTool {
|
||||
|
||||
public final int maxCharge;
|
||||
public final RcEnergyTier tier;
|
||||
|
@ -144,20 +143,19 @@ public class JackhammerItem extends PickaxeItem implements RcEnergyItem, ItemDur
|
|||
return 0;
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
// DynamicAttributeTool
|
||||
|
|
|
@ -33,7 +33,6 @@ 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.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
|
@ -42,7 +41,7 @@ import techreborn.utils.InitUtils;
|
|||
/**
|
||||
* Created by modmuss50 on 05/11/2016.
|
||||
*/
|
||||
public class ElectricTreetapItem extends Item implements RcEnergyItem, ItemDurabilityExtensions {
|
||||
public class ElectricTreetapItem extends Item implements RcEnergyItem {
|
||||
|
||||
public final int maxCharge = TechRebornConfig.electricTreetapCharge;
|
||||
public int cost = TechRebornConfig.electricTreetapCost;
|
||||
|
@ -67,20 +66,19 @@ public class ElectricTreetapItem extends Item implements RcEnergyItem, ItemDurab
|
|||
InitUtils.initPoweredItems(this, stacks);
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
|
|
|
@ -37,7 +37,6 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
@ -46,7 +45,7 @@ import techreborn.init.TRContent;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
public class RockCutterItem extends PickaxeItem implements RcEnergyItem, ItemDurabilityExtensions {
|
||||
public class RockCutterItem extends PickaxeItem implements RcEnergyItem {
|
||||
|
||||
public static final int maxCharge = TechRebornConfig.rockCutterCharge;
|
||||
public int cost = TechRebornConfig.rockCutterCost;
|
||||
|
@ -129,18 +128,18 @@ public class RockCutterItem extends PickaxeItem implements RcEnergyItem, ItemDur
|
|||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
|
|
|
@ -47,7 +47,6 @@ import org.jetbrains.annotations.Nullable;
|
|||
import reborncore.api.items.ItemStackModifiers;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
|
@ -57,7 +56,7 @@ import techreborn.utils.MessageIDs;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class NanosaberItem extends SwordItem implements RcEnergyItem, ItemDurabilityExtensions, ItemStackModifiers {
|
||||
public class NanosaberItem extends SwordItem implements RcEnergyItem, ItemStackModifiers {
|
||||
public static final int maxCharge = TechRebornConfig.nanosaberCharge;
|
||||
public int cost = TechRebornConfig.nanosaberCost;
|
||||
|
||||
|
@ -152,20 +151,19 @@ public class NanosaberItem extends SwordItem implements RcEnergyItem, ItemDurabi
|
|||
return 0;
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
// ItemStackModifiers
|
||||
|
|
|
@ -46,7 +46,6 @@ import net.minecraft.world.World;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.RcEnergyItem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.util.TorchHelper;
|
||||
import reborncore.common.powerSystem.RcEnergyTier;
|
||||
|
@ -58,7 +57,7 @@ import techreborn.utils.InitUtils;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class OmniToolItem extends PickaxeItem implements RcEnergyItem, ItemDurabilityExtensions, DynamicAttributeTool {
|
||||
public class OmniToolItem extends PickaxeItem implements RcEnergyItem, DynamicAttributeTool {
|
||||
|
||||
public final int maxCharge = TechRebornConfig.omniToolCharge;
|
||||
public int cost = TechRebornConfig.omniToolCost;
|
||||
|
@ -139,20 +138,19 @@ public class OmniToolItem extends PickaxeItem implements RcEnergyItem, ItemDurab
|
|||
tooltip.add(new LiteralText(Formatting.YELLOW + I18n.translate("techreborn.tooltip.omnitool_motto")));
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurability(ItemStack stack) {
|
||||
public boolean isItemBarVisible(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDurabilityColor(ItemStack stack) {
|
||||
return PowerSystem.getDisplayPower().colour;
|
||||
public int getItemBarColor(ItemStack stack) {
|
||||
return ItemUtils.getColorForDurabilityBar(stack);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue