Refactoring & cleaning
This commit is contained in:
parent
874559c21e
commit
e5736669ca
200 changed files with 1382 additions and 1596 deletions
|
@ -49,7 +49,7 @@ import org.apache.commons.lang3.Validate;
|
|||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 17/05/2016.
|
||||
|
@ -60,8 +60,6 @@ public class DynamicCell extends Item {
|
|||
|
||||
public DynamicCell() {
|
||||
super();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setTranslationKey("techreborn.cell");
|
||||
setMaxStackSize(64);
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
}
|
||||
|
|
|
@ -25,27 +25,24 @@
|
|||
package techreborn.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.Core;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemDestructopack extends ItemTR {
|
||||
public class ItemDestructopack extends Item {
|
||||
|
||||
public ItemDestructopack() {
|
||||
this.setTranslationKey("techreborn.destructopack");
|
||||
this.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player,
|
||||
final EnumHand hand) {
|
||||
player.openGui(Core.INSTANCE, EGui.DESTRUCTOPACK.ordinal(), world, (int) player.posX, (int) player.posY,
|
||||
(int) player.posY);
|
||||
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player, final EnumHand hand) {
|
||||
player.openGui(TechReborn.INSTANCE, EGui.DESTRUCTOPACK.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posY);
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.client.util.ITooltipFlag;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
|
@ -43,18 +44,15 @@ import reborncore.client.hud.StackInfoElement;
|
|||
import reborncore.common.util.ChatUtils;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.lib.MessageIDs;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemFrequencyTransmitter extends ItemTR {
|
||||
public class ItemFrequencyTransmitter extends Item {
|
||||
|
||||
public ItemFrequencyTransmitter() {
|
||||
setTranslationKey("techreborn.frequencyTransmitter");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:coords"), new IItemPropertyGetter() {
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn", "coords"), new IItemPropertyGetter() {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack,
|
||||
|
@ -113,7 +111,9 @@ public class ItemFrequencyTransmitter extends ItemTR {
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
public void addInformation(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
if (stack.hasTagCompound() && stack.getTagCompound() != null && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z") && stack.getTagCompound().hasKey("dim")) {
|
||||
int x = stack.getTagCompound().getInteger("x");
|
||||
int y = stack.getTagCompound().getInteger("y");
|
||||
|
|
|
@ -25,27 +25,26 @@
|
|||
package techreborn.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.Core;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemTechManual extends ItemTR {
|
||||
public class ItemManual extends Item {
|
||||
|
||||
public ItemTechManual() {
|
||||
this.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
this.setTranslationKey("techreborn.manual");
|
||||
public ItemManual() {
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player,
|
||||
final EnumHand hand) {
|
||||
player.openGui(Core.INSTANCE, EGui.MANUAL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posY);
|
||||
player.openGui(TechReborn.INSTANCE, EGui.MANUAL.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posY);
|
||||
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
|
@ -34,15 +35,13 @@ import reborncore.api.recipe.IBaseRecipeType;
|
|||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.util.WorldUtils;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemScrapBox extends ItemTR {
|
||||
public class ItemScrapBox extends Item {
|
||||
|
||||
public ItemScrapBox() {
|
||||
setTranslationKey("techreborn.scrapbox");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,13 +25,34 @@
|
|||
package techreborn.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.api.tile.IUpgrade;
|
||||
import reborncore.common.recipes.IUpgradeHandler;
|
||||
import reborncore.common.tile.TileLegacyMachineBase;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
public class ItemTR extends Item {
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public ItemTR() {
|
||||
setNoRepair();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
public class ItemUpgrade extends Item implements IUpgrade {
|
||||
|
||||
public final String name;
|
||||
public final IUpgrade behavior;
|
||||
|
||||
public ItemUpgrade(String name, IUpgrade process) {
|
||||
this.name = name;
|
||||
this.behavior = process;
|
||||
setMaxStackSize(16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(
|
||||
@Nonnull
|
||||
TileLegacyMachineBase tile,
|
||||
@Nullable
|
||||
IUpgradeHandler handler,
|
||||
@Nonnull
|
||||
ItemStack stack) {
|
||||
behavior.process(tile, handler, stack);
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2018 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.items;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.api.tile.IUpgrade;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.IUpgradeHandler;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.tile.TileLegacyMachineBase;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class ItemUpgrades extends ItemTR implements IUpgrade {
|
||||
|
||||
@ConfigRegistry(config = "items", category = "upgrades", key = "overclcoker_speed", comment = "Overclocker upgrade speed multipiler")
|
||||
public static double overclockerSpeed = 0.25;
|
||||
|
||||
@ConfigRegistry(config = "items", category = "upgrades", key = "overclcoker_power", comment = "Overclocker upgrade power multipiler")
|
||||
public static double overclockerPower = 0.75;
|
||||
|
||||
@ConfigRegistry(config = "items", category = "upgrades", key = "energy_storage", comment = "Energy storage upgrade extra power")
|
||||
public static double energyStoragePower = 40_000;
|
||||
|
||||
public ItemUpgrades() {
|
||||
setMaxStackSize(16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(@Nonnull TileLegacyMachineBase tile, @Nullable IUpgradeHandler handler, @Nonnull ItemStack stack) {
|
||||
TilePowerAcceptor powerAcceptor = null;
|
||||
if (tile instanceof TilePowerAcceptor) {
|
||||
powerAcceptor = (TilePowerAcceptor) tile;
|
||||
}
|
||||
if (stack.isItemEqual(new ItemStack(TRItems.UPGRADE_OVERCLOCKER))) {
|
||||
handler.addSpeedMulti(overclockerSpeed);
|
||||
handler.addPowerMulti(overclockerPower);
|
||||
if (powerAcceptor != null) {
|
||||
powerAcceptor.extraPowerInput += powerAcceptor.getMaxInput();
|
||||
powerAcceptor.extraPowerStoage += powerAcceptor.getBaseMaxPower();
|
||||
}
|
||||
}
|
||||
if (powerAcceptor != null) {
|
||||
if (stack.isItemEqual(new ItemStack(TRItems.UPGRADE_TRANSFORMER))) {
|
||||
powerAcceptor.extraTeir += 1;
|
||||
}
|
||||
if (stack.isItemEqual(new ItemStack(TRItems.UPGRADE_ENERGY_STORAGE))) {
|
||||
powerAcceptor.extraPowerStoage += energyStoragePower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleRightClick(TileEntity tile, ItemStack stack, Container container, int slotID) {
|
||||
|
||||
}
|
||||
}
|
|
@ -41,19 +41,17 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
||||
import reborncore.common.registration.RebornRegistry;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.items.armor.ItemTRArmour;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
@RebornRegister(modID = TechReborn.MOD_ID)
|
||||
public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo {
|
||||
|
||||
@ConfigRegistry(config = "items", category = "cloacking_device", key = "ClockingDeviceEnergyUsage", comment = "Cloacking device energy usesage (Value in FE)")
|
||||
|
@ -66,9 +64,7 @@ public class ItemCloakingDevice extends ItemTRArmour implements IEnergyItemInfo
|
|||
// 40M FE capacity with 10k FE\t charge rate
|
||||
public ItemCloakingDevice() {
|
||||
super(Reference.CLOAKING_ARMOR, EntityEquipmentSlot.CHEST);
|
||||
setTranslationKey("techreborn.cloakingdevice");
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
// Item
|
||||
|
|
|
@ -42,23 +42,20 @@ import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
|||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo {
|
||||
public class ItemLapotronicOrbpack extends ItemArmor 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 ItemLapotronPack() {
|
||||
public ItemLapotronicOrbpack() {
|
||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setTranslationKey("techreborn.lapotronpack");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
|
||||
// Item
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
|
@ -66,17 +63,17 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo {
|
|||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
return;
|
||||
}
|
||||
ItemStack uncharged = new ItemStack(TRItems.LAPOTRONIC_ORB_PACK);
|
||||
// ItemStack charged = new ItemStack(ModItems.LAPOTRONIC_ORB_PACK);
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
ItemStack uncharged = new ItemStack(TRItems.LAPOTRONIC_ORBPACK);
|
||||
// ItemStack charged = new ItemStack(ModItems.LAPOTRONIC_ORBPACK);
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
itemList.add(uncharged);
|
||||
// itemList.add(charged);
|
||||
// itemList.add(charged);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
ItemLithiumBatpack.distributePowerToInventory(world, player, itemStack, (int) transferLimit);
|
||||
ItemLithiumIonBatpack.distributePowerToInventory(world, player, itemStack, (int) transferLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,7 +93,9 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo {
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
NBTTagCompound nbt) {
|
||||
return new PoweredItemCapabilityProvider(stack);
|
||||
}
|
||||
|
||||
|
@ -120,5 +119,5 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo {
|
|||
@Override
|
||||
public int getMaxOutput() {
|
||||
return transferLimit;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,21 +44,18 @@ import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
|||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo {
|
||||
public class ItemLithiumIonBatpack extends ItemArmor implements IEnergyItemInfo {
|
||||
|
||||
// 8M FE maxCharge and 2k FE\t charge rate. Fully charged in 3 mins.
|
||||
public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge;
|
||||
public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge;
|
||||
public int transferLimit = 2_000;
|
||||
|
||||
public ItemLithiumBatpack() {
|
||||
public ItemLithiumIonBatpack() {
|
||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||
setMaxStackSize(1);
|
||||
setTranslationKey("techreborn.lithiumbatpack");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
public static void distributePowerToInventory(World world, EntityPlayer player, ItemStack itemStack, int maxSend) {
|
||||
|
@ -105,7 +102,9 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo {
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
NBTTagCompound nbt) {
|
||||
return new PoweredItemCapabilityProvider(stack);
|
||||
}
|
||||
|
||||
|
@ -121,12 +120,12 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo {
|
|||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
return;
|
||||
}
|
||||
ItemStack uncharged = new ItemStack(TRItems.LITHIUM_BATTERY_PACK);
|
||||
// ItemStack charged = new ItemStack(ModItems.LITHIUM_BATTERY_PACK);
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
ItemStack uncharged = new ItemStack(TRItems.LITHIUM_ION_BATPACK);
|
||||
// ItemStack charged = new ItemStack(ModItems.LITHIUM_ION_BATPACK);
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
itemList.add(uncharged);
|
||||
// itemList.add(charged);
|
||||
// itemList.add(charged);
|
||||
}
|
||||
|
||||
// IEnergyItemInfo
|
|
@ -29,7 +29,6 @@ import net.minecraft.item.ItemArmor;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
|
@ -53,7 +52,6 @@ public class ItemTRArmour extends ItemArmor {
|
|||
setTranslationKey(material.name().toLowerCase() + "Leggings");
|
||||
if (slot == EntityEquipmentSlot.FEET)
|
||||
setTranslationKey(material.name().toLowerCase() + "Boots");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ package techreborn.items.battery;
|
|||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -38,28 +39,28 @@ import reborncore.api.power.IEnergyItemInfo;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.items.ItemTR;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ItemBattery extends ItemTR implements IEnergyItemInfo {
|
||||
public class ItemBattery extends Item implements IEnergyItemInfo {
|
||||
|
||||
String name;
|
||||
int maxEnergy = 0;
|
||||
int maxTransfer = 0;
|
||||
|
||||
public ItemBattery(String name, int maxEnergy, int maxTransfer) {
|
||||
public ItemBattery(int maxEnergy, int maxTransfer) {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(1);
|
||||
setTranslationKey("techreborn." + name);
|
||||
this.name = name;
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.maxTransfer = maxTransfer;
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter() {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
public float apply(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn,
|
||||
@Nullable
|
||||
EntityLivingBase entityIn) {
|
||||
if (!stack.isEmpty() && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() == 0) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ public class ItemBattery extends ItemTR implements IEnergyItemInfo {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
|
@ -86,7 +87,9 @@ public class ItemBattery extends ItemTR implements IEnergyItemInfo {
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
NBTTagCompound nbt) {
|
||||
return new PoweredItemCapabilityProvider(stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ItemEnergyCrystal extends ItemBattery {
|
|||
|
||||
// 4M FE storage with 1k charge rate
|
||||
public ItemEnergyCrystal() {
|
||||
super("energyCrystal", ConfigTechReborn.EnergyCrystalMaxCharge, 1_000);
|
||||
super(ConfigTechReborn.EnergyCrystalMaxCharge, 1_000);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ItemLapotronCrystal extends ItemBattery {
|
|||
|
||||
// 40M FE capacity with 10k FE\t charge rate
|
||||
public ItemLapotronCrystal() {
|
||||
super("lapotronCrystal", ConfigTechReborn.LapotronCrystalMaxCharge, 10_000);
|
||||
super(ConfigTechReborn.LapotronCrystalMaxCharge, 10_000);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -45,12 +45,12 @@ public class ItemLapotronCrystal extends ItemBattery {
|
|||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRItems.LAPOTRONIC_CRYSTAL);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
ItemStack stack = new ItemStack(TRItems.LAPOTRON_CRYSTAL);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
||||
// itemList.add(charged);
|
||||
// itemList.add(charged);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ItemLapotronicOrb extends ItemBattery {
|
|||
|
||||
// 400M capacity with 100k FE\t charge rate
|
||||
public ItemLapotronicOrb() {
|
||||
super("lapotronicorb", ConfigTechReborn.LapotronicOrbMaxCharge, 100_000);
|
||||
super(ConfigTechReborn.LapotronicOrbMaxCharge, 100_000);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -31,11 +31,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import techreborn.init.TRItems;
|
||||
|
||||
public class ItemLithiumBattery extends ItemBattery {
|
||||
public class ItemLithiumIonBattery extends ItemBattery {
|
||||
|
||||
// 400k FE with 1k FE\t charge rate
|
||||
public ItemLithiumBattery() {
|
||||
super("lithiumBattery", 400_000, 1_000);
|
||||
public ItemLithiumIonBattery() {
|
||||
super(400_000, 1_000);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -44,9 +44,9 @@ public class ItemLithiumBattery extends ItemBattery {
|
|||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRItems.LITHIUM_BATTERY);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
ItemStack stack = new ItemStack(TRItems.LITHIUM_ION_BATTERY);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
//capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
|
@ -31,11 +31,11 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import techreborn.init.TRItems;
|
||||
|
||||
public class ItemReBattery extends ItemBattery {
|
||||
public class ItemRechargeableBattery extends ItemBattery {
|
||||
|
||||
// 40k FE capacity with 100 FE\t charge rate
|
||||
public ItemReBattery() {
|
||||
super("rebattery", 40_000, 100);
|
||||
public ItemRechargeableBattery() {
|
||||
super(40_000, 100);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -44,8 +44,8 @@ public class ItemReBattery extends ItemBattery {
|
|||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRItems.RE_BATTERY);
|
||||
// ItemStack charged = stack.copy();
|
||||
ItemStack stack = new ItemStack(TRItems.RECHARGEABLE_BATTERY);
|
||||
// ItemStack charged = stack.copy();
|
||||
//IEnergyStorage capEnergy = charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
//capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
|
@ -44,7 +44,6 @@ import reborncore.api.power.IEnergyItemInfo;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
@ -60,35 +59,38 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo {
|
|||
|
||||
public ItemChainsaw(ToolMaterial material, int energyCapacity, float unpoweredSpeed) {
|
||||
super(material);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
this.maxCharge = energyCapacity;
|
||||
this.efficiency = unpoweredSpeed;
|
||||
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:animated"), new IItemPropertyGetter() {
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn", "animated"), new IItemPropertyGetter() {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
public float apply(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn,
|
||||
@Nullable
|
||||
EntityLivingBase entityIn) {
|
||||
if (!stack.isEmpty() && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() >= cost
|
||||
&& entityIn != null && entityIn.getHeldItemMainhand().equals(stack)) {
|
||||
&& entityIn != null && entityIn.getHeldItemMainhand().equals(stack)) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// ItemAxe
|
||||
@Override
|
||||
public float getDestroySpeed(ItemStack stack, IBlockState state) {
|
||||
if (stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() >= cost
|
||||
&& (state.getBlock().isToolEffective("axe", state) || state.getMaterial() == Material.WOOD)) {
|
||||
&& (state.getBlock().isToolEffective("axe", state) || state.getMaterial() == Material.WOOD)) {
|
||||
return this.poweredSpeed;
|
||||
} else {
|
||||
return super.getDestroySpeed(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ItemTool
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, EntityLivingBase entityLiving) {
|
||||
|
@ -121,7 +123,9 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo {
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
NBTTagCompound nbt) {
|
||||
return new PoweredItemCapabilityProvider(stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -36,12 +37,11 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import reborncore.api.power.IEnergyInterfaceTile;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.items.ItemTR;
|
||||
|
||||
/**
|
||||
* Created by Mark on 20/03/2016.
|
||||
*/
|
||||
public class ItemDebugTool extends ItemTR {
|
||||
public class ItemDebugTool extends Item {
|
||||
|
||||
public ItemDebugTool() {
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ import reborncore.api.power.IEnergyItemInfo;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
@ -55,12 +54,11 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo {
|
|||
public ItemDrill(ToolMaterial material, int energyCapacity, float unpoweredSpeed, float efficiencyOnProperMaterial) {
|
||||
super(material);
|
||||
this.efficiency = efficiencyOnProperMaterial;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
this.maxCharge = energyCapacity;
|
||||
this.unpoweredSpeed = unpoweredSpeed;
|
||||
}
|
||||
|
||||
|
||||
// ItemPickaxe
|
||||
@Override
|
||||
public float getDestroySpeed(ItemStack stack, IBlockState state) {
|
||||
|
@ -68,13 +66,13 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo {
|
|||
return unpoweredSpeed;
|
||||
}
|
||||
if (Items.WOODEN_PICKAXE.getDestroySpeed(stack, state) > 1.0F
|
||||
|| Items.WOODEN_SHOVEL.getDestroySpeed(stack, state) > 1.0F) {
|
||||
|| Items.WOODEN_SHOVEL.getDestroySpeed(stack, state) > 1.0F) {
|
||||
return efficiency;
|
||||
} else {
|
||||
return super.getDestroySpeed(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ItemTool
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, EntityLivingBase entityLiving) {
|
||||
|
@ -84,12 +82,12 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//Item
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
|
@ -113,7 +111,9 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo {
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
NBTTagCompound nbt) {
|
||||
return new PoweredItemCapabilityProvider(stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
@ -36,13 +37,13 @@ import reborncore.common.powerSystem.PowerSystem;
|
|||
import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.items.ItemTR;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 05/11/2016.
|
||||
*/
|
||||
public class ItemElectricTreetap extends ItemTR implements IEnergyItemInfo {
|
||||
public class ItemElectricTreetap extends Item implements IEnergyItemInfo {
|
||||
|
||||
public static final int maxCharge = 10_000;
|
||||
public int cost = 20;
|
||||
|
|
|
@ -24,11 +24,9 @@
|
|||
|
||||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -41,8 +39,7 @@ import reborncore.api.power.IEnergyItemInfo;
|
|||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.utils.OreDictUtils;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
@ -56,23 +53,23 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo {
|
|||
public ItemJackhammer(ToolMaterial material, int energyCapacity) {
|
||||
super(material);
|
||||
efficiency = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(240);
|
||||
this.maxCharge = energyCapacity;
|
||||
}
|
||||
|
||||
// ItemPicjaxe
|
||||
|
||||
// ItemPickaxe
|
||||
@Override
|
||||
public float getDestroySpeed(ItemStack stack, IBlockState state) {
|
||||
if ((OreDictUtils.isOre(state, "stone") || state.getBlock() == Blocks.STONE)
|
||||
&& stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() >= cost) {
|
||||
return efficiency;
|
||||
} else {
|
||||
return 0.5F;
|
||||
}
|
||||
//tOdo: check if stone tag
|
||||
// if ((OreDictUtils.isOre(state, "stone") || state.getBlock() == Blocks.STONE)
|
||||
// && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() >= cost) {
|
||||
// return efficiency;
|
||||
// } else {
|
||||
return 0.5F;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// ItemTool
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, EntityLivingBase entityLiving) {
|
||||
|
@ -82,7 +79,7 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
|
@ -91,15 +88,17 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo {
|
|||
// Item
|
||||
@Override
|
||||
public boolean canHarvestBlock(final IBlockState state, final ItemStack stack) {
|
||||
return OreDictUtils.isOre(state, "stone")
|
||||
|| state.getMaterial() == Material.ROCK && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() >= cost;
|
||||
return false;
|
||||
//todo: cheeck if stone tag
|
||||
// return OreDictUtils.isOre(state, "stone")
|
||||
// || state.getMaterial() == Material.ROCK && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() >= cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
return 1 - ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
@ -117,10 +116,12 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo {
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
NBTTagCompound nbt) {
|
||||
return new PoweredItemCapabilityProvider(stack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldCauseBlockBreakReset(ItemStack oldStack, ItemStack newStack) {
|
||||
return !(newStack.isItemEqual(oldStack));
|
||||
|
|
|
@ -56,7 +56,6 @@ import reborncore.common.util.ItemUtils;
|
|||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.lib.MessageIDs;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
@ -70,15 +69,18 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
public ItemNanosaber() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
setNoRepair();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||
public float apply(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn,
|
||||
@Nullable
|
||||
EntityLivingBase entityIn) {
|
||||
if (ItemUtils.isActive(stack)) {
|
||||
IEnergyStorage capEnergy = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
if (capEnergy.getMaxEnergyStored() - capEnergy.getEnergyStored() >= 0.9 * capEnergy.getMaxEnergyStored()) {
|
||||
if (capEnergy.getMaxEnergyStored() - capEnergy.getEnergyStored() >= 0.9 * capEnergy.getMaxEnergyStored()) {
|
||||
return 0.5F;
|
||||
}
|
||||
return 1.0F;
|
||||
|
@ -87,7 +89,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// ItemSword
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
|
@ -98,8 +100,8 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) {
|
||||
|
@ -110,13 +112,13 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
}
|
||||
if (slot == EntityEquipmentSlot.MAINHAND) {
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(),
|
||||
new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) modifier, 0));
|
||||
new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", (double) modifier, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(),
|
||||
new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
|
||||
new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
|
||||
}
|
||||
return multimap;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player, final EnumHand hand) {
|
||||
final ItemStack stack = player.getHeldItem(hand);
|
||||
|
@ -156,7 +158,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
@Override
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (ItemUtils.isActive(stack) && stack.getCapability(CapabilityEnergy.ENERGY, null).getEnergyStored() < cost) {
|
||||
if(worldIn.isRemote){
|
||||
if (worldIn.isRemote) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberEnergyError") + " "
|
||||
+ TextFormatting.GOLD + I18n
|
||||
|
@ -188,7 +190,9 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack,
|
||||
@Nullable
|
||||
NBTTagCompound nbt) {
|
||||
return new PoweredItemCapabilityProvider(stack);
|
||||
}
|
||||
|
||||
|
@ -203,26 +207,28 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
inactiveUncharged.setTagCompound(new NBTTagCompound());
|
||||
inactiveUncharged.getTagCompound().setBoolean("isActive", false);
|
||||
|
||||
// ItemStack inactiveCharged = new ItemStack(ModItems.NANOSABER);
|
||||
// inactiveCharged.setTagCompound(new NBTTagCompound());
|
||||
// inactiveCharged.getTagCompound().setBoolean("isActive", false);
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) inactiveCharged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
// ItemStack inactiveCharged = new ItemStack(ModItems.NANOSABER);
|
||||
// inactiveCharged.setTagCompound(new NBTTagCompound());
|
||||
// inactiveCharged.getTagCompound().setBoolean("isActive", false);
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) inactiveCharged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
// ItemStack activeCharged = new ItemStack(ModItems.NANOSABER);
|
||||
// activeCharged.setTagCompound(new NBTTagCompound());
|
||||
// activeCharged.getTagCompound().setBoolean("isActive", true);
|
||||
// ForgePowerItemManager capEnergy2 = (ForgePowerItemManager) activeCharged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy2.setEnergyStored(capEnergy2.getMaxEnergyStored());
|
||||
// ItemStack activeCharged = new ItemStack(ModItems.NANOSABER);
|
||||
// activeCharged.setTagCompound(new NBTTagCompound());
|
||||
// activeCharged.getTagCompound().setBoolean("isActive", true);
|
||||
// ForgePowerItemManager capEnergy2 = (ForgePowerItemManager) activeCharged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy2.setEnergyStored(capEnergy2.getMaxEnergyStored());
|
||||
|
||||
itemList.add(inactiveUncharged);
|
||||
// itemList.add(inactiveCharged);
|
||||
// itemList.add(activeCharged);
|
||||
// itemList.add(inactiveCharged);
|
||||
// itemList.add(activeCharged);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
public void addInformation(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
if (!ItemUtils.isActive(stack)) {
|
||||
tooltip.add(TextFormatting.GRAY + I18n.format("techreborn.message.nanosaberInactive"));
|
||||
} else {
|
||||
|
|
|
@ -49,7 +49,7 @@ import reborncore.common.util.ItemUtils;
|
|||
import reborncore.common.util.TorchHelper;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
@ -65,7 +65,6 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo {
|
|||
public ItemOmniTool() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
efficiency = 13F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(200);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
|
|||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.TRItems;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
import techreborn.utils.InitUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
@ -61,7 +61,6 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo {
|
|||
// 400k FE with 1k FE\t charge rate
|
||||
public ItemRockCutter() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
efficiency = 16F;
|
||||
}
|
||||
|
|
|
@ -49,12 +49,12 @@ public class ItemSteelChainsaw extends ItemChainsaw {
|
|||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRItems.STEEL_CHAINSAW);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
||||
// itemList.add(charged);
|
||||
// itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,16 +42,16 @@ public class ItemSteelJackhammer extends ItemJackhammer {
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems( CreativeTabs par2CreativeTabs, NonNullList<ItemStack> itemList) {
|
||||
public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList<ItemStack> itemList) {
|
||||
if (!isInCreativeTab(par2CreativeTabs)) {
|
||||
return;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TRItems.STEEL_JACKHAMMER);
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
// ItemStack charged = stack.copy();
|
||||
// ForgePowerItemManager capEnergy = (ForgePowerItemManager) charged.getCapability(CapabilityEnergy.ENERGY, null);
|
||||
// capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
itemList.add(stack);
|
||||
// itemList.add(charged);
|
||||
// itemList.add(charged);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ package techreborn.items.tools;
|
|||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
public class ItemTRAxe extends ItemAxe {
|
||||
|
||||
|
@ -40,7 +39,6 @@ public class ItemTRAxe extends ItemAxe {
|
|||
public ItemTRAxe(ToolMaterial material, String repairOreDict) {
|
||||
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
public class ItemTRHoe extends ItemHoe {
|
||||
|
||||
|
@ -42,7 +41,6 @@ public class ItemTRHoe extends ItemHoe {
|
|||
public ItemTRHoe(ToolMaterial material, String repairOreDict) {
|
||||
super(material);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,6 @@ package techreborn.items.tools;
|
|||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
public class ItemTRPickaxe extends ItemPickaxe {
|
||||
|
||||
|
@ -40,7 +39,6 @@ public class ItemTRPickaxe extends ItemPickaxe {
|
|||
public ItemTRPickaxe(ToolMaterial material, String repairOreDict) {
|
||||
super(material);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,6 @@ package techreborn.items.tools;
|
|||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
public class ItemTRSpade extends ItemSpade {
|
||||
|
||||
|
@ -40,7 +39,6 @@ public class ItemTRSpade extends ItemSpade {
|
|||
public ItemTRSpade(ToolMaterial material, String repairOreDict) {
|
||||
super(material);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,6 @@ package techreborn.items.tools;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
public class ItemTRSword extends ItemSword {
|
||||
|
||||
|
@ -40,7 +39,6 @@ public class ItemTRSword extends ItemSword {
|
|||
public ItemTRSword(ToolMaterial material, String repairOreDict) {
|
||||
super(material);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,17 +24,16 @@
|
|||
|
||||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.items.ItemTR;
|
||||
|
||||
public class ItemTreeTap extends ItemTR {
|
||||
public class ItemTreeTap extends Item {
|
||||
|
||||
public ItemTreeTap() {
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(20);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return stack.getMetadata() != 0;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -32,12 +33,11 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.api.IToolHandler;
|
||||
import techreborn.items.ItemTR;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
*/
|
||||
public class ItemWrench extends ItemTR implements IToolHandler {
|
||||
public class ItemWrench extends Item implements IToolHandler {
|
||||
|
||||
public ItemWrench() {
|
||||
setMaxStackSize(1);
|
||||
|
@ -51,7 +51,7 @@ public class ItemWrench extends ItemTR implements IToolHandler {
|
|||
|
||||
@Override
|
||||
public boolean handleTool(ItemStack stack, BlockPos pos, World world, EntityPlayer player, EnumFacing side, boolean damage) {
|
||||
if(damage){
|
||||
if (damage) {
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue