1147 - Initial auto mappings pass

This commit is contained in:
modmuss50 2019-05-26 12:37:59 +01:00
parent 48198dbcb3
commit 4e03ac893c
291 changed files with 3335 additions and 3504 deletions

View file

@ -25,18 +25,18 @@
package techreborn.items.armor;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.DefaultedList;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.energy.IEnergyStorage;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.PoweredItemContainerProvider;
@ -60,40 +60,40 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
// 40M FE capacity with 10k FE\t charge rate
public ItemCloakingDevice() {
super(TRArmorMaterial.CLOAKING, EntityEquipmentSlot.CHEST);
super(TRArmorMaterial.CLOAKING, EquipmentSlot.CHEST);
}
// Item
@Override
@OnlyIn(Dist.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
@Environment(EnvType.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return "techreborn:" + "textures/models/armor/cloaking.png";
}
@Override
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entityIn;
public void onEntityTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entityIn;
IEnergyStorage capEnergy = new ForgePowerItemManager(stack);
if (capEnergy != null && capEnergy.getEnergyStored() >= usage) {
capEnergy.extractEnergy(usage, false);
player.setInvisible(true);
} else {
if (!player.isPotionActive(MobEffects.INVISIBILITY)) {
if (!player.hasStatusEffect(StatusEffects.INVISIBILITY)) {
player.setInvisible(false);
}
}
}
}
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
public void onArmorTick(World world, PlayerEntity player, ItemStack stack) {
}
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
@Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
if (!isInGroup(group)) {
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.CLOAKING_DEVICE);
@ -121,7 +121,7 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
@Override
@Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
return new PoweredItemContainerProvider(stack);
}

View file

@ -25,15 +25,15 @@
package techreborn.items.armor;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.DefaultedList;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.PoweredItemContainerProvider;
@ -45,20 +45,20 @@ import techreborn.init.TRContent;
import javax.annotation.Nullable;
public class ItemLapotronicOrbpack extends ItemArmor implements IEnergyItemInfo {
public class ItemLapotronicOrbpack extends ArmorItem implements IEnergyItemInfo {
// 400M FE maxCharge and 100k FE\t charge rate. Fully charged in 3 mins.
public static final int maxCharge = ConfigTechReborn.LapotronPackCharge;
public int transferLimit = 100_000;
public ItemLapotronicOrbpack() {
super(ArmorMaterial.DIAMOND, EntityEquipmentSlot.CHEST, new Item.Properties().group(TechReborn.ITEMGROUP).maxStackSize(1));
super(ArmorMaterials.DIAMOND, EquipmentSlot.CHEST, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
}
// Item
@Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
if (!isInGroup(group)) {
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.LAPOTRONIC_ORBPACK);
@ -70,9 +70,9 @@ public class ItemLapotronicOrbpack extends ItemArmor implements IEnergyItemInfo
}
@Override
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof EntityPlayer) {
ItemLithiumIonBatpack.distributePowerToInventory(worldIn, (EntityPlayer) entityIn, stack,
public void onEntityTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof PlayerEntity) {
ItemLithiumIonBatpack.EnvTypeributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack,
(int) transferLimit);
}
}
@ -96,13 +96,13 @@ public class ItemLapotronicOrbpack extends ItemArmor implements IEnergyItemInfo
@Nullable
public ICapabilityProvider initCapabilities(ItemStack stack,
@Nullable
NBTTagCompound nbt) {
CompoundTag nbt) {
return new PoweredItemContainerProvider(stack);
}
@Override
@OnlyIn(Dist.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
@Environment(EnvType.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return "techreborn:" + "textures/models/armor/lapotronpack.png";
}

View file

@ -25,15 +25,15 @@
package techreborn.items.armor;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.DefaultedList;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.power.IEnergyItemInfo;
import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.PowerSystem;
@ -46,35 +46,35 @@ import techreborn.init.TRContent;
import javax.annotation.Nullable;
public class ItemLithiumIonBatpack extends ItemArmor implements IEnergyItemInfo {
public class ItemLithiumIonBatpack extends ArmorItem implements IEnergyItemInfo {
// 8M FE maxCharge and 2k FE\t charge rate. Fully charged in 3 mins.
public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge;
public int transferLimit = 2_000;
public ItemLithiumIonBatpack() {
super(ArmorMaterial.DIAMOND, EntityEquipmentSlot.CHEST, new Item.Properties().group(TechReborn.ITEMGROUP).maxStackSize(1));
super(ArmorMaterials.DIAMOND, EquipmentSlot.CHEST, new Item.Settings().itemGroup(TechReborn.ITEMGROUP).stackSize(1));
}
public static void distributePowerToInventory(World world, EntityPlayer player, ItemStack itemStack, int maxSend) {
if (world.isRemote) {
public static void EnvTypeributePowerToInventory(World world, PlayerEntity player, ItemStack itemStack, int maxSend) {
if (world.isClient) {
return;
}
ForgePowerItemManager capEnergy = new ForgePowerItemManager(itemStack);
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
if (!player.inventory.getStackInSlot(i).isEmpty()) {
ExternalPowerSystems.chargeItem(capEnergy, player.inventory.getStackInSlot(i));
for (int i = 0; i < player.inventory.getInvSize(); i++) {
if (!player.inventory.getInvStack(i).isEmpty()) {
ExternalPowerSystems.chargeItem(capEnergy, player.inventory.getInvStack(i));
}
}
}
// Item
@Override
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof EntityPlayer) {
distributePowerToInventory(worldIn, (EntityPlayer) entityIn, stack, (int) transferLimit);
public void onEntityTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
if (entityIn instanceof PlayerEntity) {
EnvTypeributePowerToInventory(worldIn, (PlayerEntity) entityIn, stack, (int) transferLimit);
}
}
@ -95,20 +95,20 @@ public class ItemLithiumIonBatpack extends ItemArmor implements IEnergyItemInfo
@Override
@Nullable
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
return new PoweredItemContainerProvider(stack);
}
@Override
@OnlyIn(Dist.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
@Environment(EnvType.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
return "techreborn:" + "textures/models/armor/lithiumbatpack.png";
}
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
@Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
if (!isInGroup(group)) {
public void appendItemsForGroup(ItemGroup group, DefaultedList<ItemStack> items) {
if (!isInItemGroup(group)) {
return;
}
ItemStack uncharged = new ItemStack(TRContent.LITHIUM_ION_BATPACK);

View file

@ -24,10 +24,10 @@
package techreborn.items.armor;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import reborncore.common.util.ItemUtils;
import techreborn.TechReborn;
@ -36,33 +36,33 @@ import techreborn.events.TRRecipeHandler;
/**
* Created by modmuss50 on 26/02/2016.
*/
public class ItemTRArmour extends ItemArmor {
public class ItemTRArmour extends ArmorItem {
String repairOreDict = "";
public ItemTRArmour(IArmorMaterial material, EntityEquipmentSlot slot) {
public ItemTRArmour(ArmorMaterial material, EquipmentSlot slot) {
this(material, slot, "");
}
public ItemTRArmour(IArmorMaterial material, EntityEquipmentSlot slot, String repairOreDict) {
super(material, slot, (new Item.Properties()).group(TechReborn.ITEMGROUP).maxStackSize(1));
public ItemTRArmour(ArmorMaterial material, EquipmentSlot slot, String repairOreDict) {
super(material, slot, (new Item.Settings()).itemGroup(TechReborn.ITEMGROUP).stackSize(1));
this.repairOreDict = repairOreDict;
if (slot == EntityEquipmentSlot.HEAD)
if (slot == EquipmentSlot.HEAD)
//setTranslationKey(material.name().toLowerCase() + "Helmet");
if (slot == EntityEquipmentSlot.CHEST)
if (slot == EquipmentSlot.CHEST)
//setTranslationKey(material.name().toLowerCase() + "Chestplate");
if (slot == EntityEquipmentSlot.LEGS)
if (slot == EquipmentSlot.LEGS)
//setTranslationKey(material.name().toLowerCase() + "Leggings");
if (slot == EntityEquipmentSlot.FEET)
if (slot == EquipmentSlot.FEET)
//setTranslationKey(material.name().toLowerCase() + "Boots");
TRRecipeHandler.hideEntry(this);
}
@Override
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
public boolean canRepair(ItemStack toRepair, ItemStack repair) {
if (toRepair.getItem() == this && !repairOreDict.isEmpty()) {
return ItemUtils.isInputEqual(repairOreDict, repair, false, true);
}
return super.getIsRepairable(toRepair, repair);
return super.canRepair(toRepair, repair);
}
}