Item fixes, it compiles :D
This commit is contained in:
parent
7a441cea77
commit
1c783abf9d
22 changed files with 97 additions and 87 deletions
|
@ -27,6 +27,7 @@ package techreborn.api;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -37,6 +38,6 @@ public interface IC2Helper {
|
|||
|
||||
public void initDuplicates();
|
||||
|
||||
public boolean extractSap(EntityPlayer player, World world, BlockPos pos, EnumFacing side, IBlockState state, List<ItemStack> stacks);
|
||||
public boolean extractSap(ItemUseContext context, List<ItemStack> stacks);
|
||||
|
||||
}
|
||||
|
|
|
@ -26,10 +26,7 @@ package techreborn.items;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFlowingFluid;
|
||||
import net.minecraft.block.BlockStaticLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Fluids;
|
||||
|
@ -53,6 +50,7 @@ import reborncore.common.util.StringUtils;
|
|||
import techreborn.TechReborn;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 17/05/2016.
|
||||
|
@ -67,7 +65,7 @@ public class DynamicCell extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
//Clearing tag because ItemUtils.isItemEqual doesn't handle tags ForgeCaps and display
|
||||
//And breaks ability to use in recipes
|
||||
//TODO: Property ItemUtils.isItemEquals tags equality handling?
|
||||
|
@ -149,21 +147,21 @@ public class DynamicCell extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(ItemGroup tab, NonNullList<ItemStack> subItems) {
|
||||
public void fillItemGroup(ItemGroup tab, NonNullList<ItemStack> subItems) {
|
||||
if (!isInGroup(tab)) {
|
||||
return;
|
||||
}
|
||||
subItems.add(getEmptyCell(1));
|
||||
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
|
||||
for (Fluid fluid : FluidUtils.getAllFluids()) {
|
||||
subItems.add(getCellWithFluid(fluid));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
public String getTranslationKey(ItemStack stack) {
|
||||
FluidStack fluidStack = getFluidHandler(stack).getFluid();
|
||||
if (fluidStack == null)
|
||||
return super.getItemStackDisplayName(stack);
|
||||
return super.getTranslationKey(stack);
|
||||
return StringUtils.t("item.techreborn.cell.fluid.name").replaceAll("\\$fluid\\$", fluidStack.getLocalizedName());
|
||||
}
|
||||
|
||||
|
@ -198,7 +196,7 @@ public class DynamicCell extends Item {
|
|||
super(container, capacity);
|
||||
|
||||
//backwards compatibility
|
||||
if (container.hasTag() && container.getTag().hasKey("FluidName")) {
|
||||
if (container.hasTag() && container.getTag().contains("FluidName")) {
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTag());
|
||||
if (stack != null) {
|
||||
container.setTag(new NBTTagCompound());
|
||||
|
@ -235,7 +233,7 @@ public class DynamicCell extends Item {
|
|||
@Override
|
||||
public ItemStack getContainer() {
|
||||
ItemStack cell;
|
||||
if (container.hasTag() && container.getTag().hasKey(FLUID_NBT_KEY)) {
|
||||
if (container.hasTag() && container.getTag().contains(FLUID_NBT_KEY)) {
|
||||
cell = super.getContainer();
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -28,18 +28,18 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import techreborn.utils.FluidUtils;
|
||||
|
||||
public class ItemCells {
|
||||
public static ItemStack getCellByName(String name, int count) {
|
||||
if (name.equalsIgnoreCase("empty") || name.equalsIgnoreCase("cell")) {
|
||||
return DynamicCell.getEmptyCell(count).copy();
|
||||
}
|
||||
Fluid fluid = FluidRegistry.getFluid("fluid" + name.toLowerCase());
|
||||
Fluid fluid = FluidUtils.getFluid("fluid" + name.toLowerCase());
|
||||
if (fluid == null) {
|
||||
fluid = FluidRegistry.getFluid(name.toLowerCase());
|
||||
fluid = FluidUtils.getFluid(name.toLowerCase());
|
||||
if (fluid == null) {
|
||||
fluid = FluidRegistry.getFluid(name.toLowerCase());
|
||||
fluid = FluidUtils.getFluid(name.toLowerCase());
|
||||
}
|
||||
}
|
||||
Validate.notNull(fluid, "The fluid " + name + " could not be found");
|
||||
|
|
|
@ -35,6 +35,7 @@ import net.minecraft.item.ItemUseContext;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
@ -90,8 +91,8 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
TextFormatting.GRAY + " Z: " +
|
||||
TextFormatting.GOLD + pos.getZ() +
|
||||
TextFormatting.GRAY + " " + I18n.format("techreborn.message.in") + " " +
|
||||
TextFormatting.GOLD + DimensionManager.getProviderType(world.provider.getDimension())
|
||||
.getName() + " (" + world.getDimension().getType().getRegistryName() + ")"));
|
||||
TextFormatting.GOLD + world.getDimension().getType().getRegistryName()
|
||||
+ " (" + world.getDimension().getType().getRegistryName() + ")"));
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
@ -124,7 +125,7 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
tooltip.add(new TextComponentString(TextFormatting.GRAY + "X: " + TextFormatting.GOLD + x));
|
||||
tooltip.add(new TextComponentString(TextFormatting.GRAY + "Y: " + TextFormatting.GOLD + y));
|
||||
tooltip.add(new TextComponentString(TextFormatting.GRAY + "Z: " + TextFormatting.GOLD + z));
|
||||
tooltip.add(new TextComponentString(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName()));
|
||||
tooltip.add(new TextComponentString(TextFormatting.DARK_GRAY + IRegistry.DIMENSION_TYPE.get(dim).getRegistryName().toString()));
|
||||
|
||||
} else {
|
||||
tooltip.add(new TextComponentString(TextFormatting.GRAY + I18n.format("techreborn.message.noCoordsSet")));
|
||||
|
@ -147,7 +148,7 @@ public class ItemFrequencyTransmitter extends Item {
|
|||
int coordY = stack.getTag().getInt("y");
|
||||
int coordZ = stack.getTag().getInt("z");
|
||||
int coordDim = stack.getTag().getInt("dim");
|
||||
text = grey + "X: " + gold + coordX + grey + " Y: " + gold + coordY + grey + " Z: " + gold + coordZ + grey + " Dim: " + gold + DimensionManager.getProviderType(coordDim).getName() + " (" + coordDim + ")";
|
||||
text = grey + "X: " + gold + coordX + grey + " Y: " + gold + coordY + grey + " Z: " + gold + coordZ + grey + " Dim: " + gold + IRegistry.DIMENSION_TYPE.get(coordDim).getRegistryName().toString() + " (" + coordDim + ")";
|
||||
} else {
|
||||
text = grey + I18n.format("techreborn.message.noCoordsSet");
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -40,7 +41,7 @@ public class ItemAdvancedChainsaw extends ItemChainsaw {
|
|||
|
||||
// 400k max charge with 1k charge rate
|
||||
public ItemAdvancedChainsaw() {
|
||||
super(ToolMaterial.DIAMOND, ConfigTechReborn.AdvancedChainsawCharge, 1.0F);
|
||||
super(ItemTier.DIAMOND, ConfigTechReborn.AdvancedChainsawCharge, 1.0F);
|
||||
this.cost = 250;
|
||||
this.transferLimit = 1000;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -40,7 +41,7 @@ public class ItemAdvancedDrill extends ItemDrill {
|
|||
|
||||
// 400k max charge with 1k charge rate
|
||||
public ItemAdvancedDrill() {
|
||||
super(ToolMaterial.DIAMOND, ConfigTechReborn.AdvancedDrillCharge, 0.5F, 15F);
|
||||
super(ItemTier.DIAMOND, ConfigTechReborn.AdvancedDrillCharge, 0.5F, 15F);
|
||||
this.cost = 250;
|
||||
this.transferLimit = 1000;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ package techreborn.items.tool.advanced;
|
|||
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -38,7 +39,7 @@ public class ItemAdvancedJackhammer extends ItemJackhammer {
|
|||
|
||||
// 400k max charge with 1k charge rate
|
||||
public ItemAdvancedJackhammer() {
|
||||
super(ToolMaterial.DIAMOND, ConfigTechReborn.AdvancedJackhammerCharge);
|
||||
super(ItemTier.DIAMOND, ConfigTechReborn.AdvancedJackhammerCharge);
|
||||
this.cost = 100;
|
||||
this.efficiency = 16F;
|
||||
this.transferLimit = 1000;
|
||||
|
|
|
@ -25,20 +25,19 @@
|
|||
package techreborn.items.tool.advanced;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import reborncore.api.power.IEnergyItemInfo;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
|
@ -60,8 +59,7 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo {
|
|||
|
||||
// 400k FE with 1k FE\t charge rate
|
||||
public ItemRockCutter() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
setMaxStackSize(1);
|
||||
super(ItemTier.DIAMOND, 1, 1, new Item.Properties().maxStackSize(1));
|
||||
efficiency = 16F;
|
||||
}
|
||||
|
||||
|
@ -97,11 +95,11 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass, @Nullable EntityPlayer player, @Nullable IBlockState blockState) {
|
||||
if (!stack.isItemEnchanted()) {
|
||||
public int getHarvestLevel(ItemStack stack, ToolType toolType, @Nullable EntityPlayer player, @Nullable IBlockState blockState) {
|
||||
if (!stack.isEnchanted()) {
|
||||
stack.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
}
|
||||
return super.getHarvestLevel(stack, toolClass, player, blockState);
|
||||
return super.getHarvestLevel(stack, toolType, player, blockState);
|
||||
}
|
||||
|
||||
// Item
|
||||
|
@ -112,7 +110,7 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo {
|
|||
|
||||
@Override
|
||||
public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) {
|
||||
if (!stack.isItemEnchanted()) {
|
||||
if (!stack.isEnchanted()) {
|
||||
stack.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -39,7 +40,7 @@ import techreborn.items.tool.ItemChainsaw;
|
|||
public class ItemBasicChainsaw extends ItemChainsaw {
|
||||
|
||||
public ItemBasicChainsaw() {
|
||||
super(ToolMaterial.IRON, ConfigTechReborn.BasicChainsawCharge, 0.5F);
|
||||
super(ItemTier.IRON, ConfigTechReborn.BasicChainsawCharge, 0.5F);
|
||||
this.cost = 50;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ package techreborn.items.tool.basic;
|
|||
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -37,7 +38,7 @@ import techreborn.items.tool.ItemJackhammer;
|
|||
public class ItemBasicJackhammer extends ItemJackhammer {
|
||||
|
||||
public ItemBasicJackhammer() {
|
||||
super(ToolMaterial.DIAMOND, ConfigTechReborn.BasicJackhammerCharge);
|
||||
super(ItemTier.DIAMOND, ConfigTechReborn.BasicJackhammerCharge);
|
||||
this.cost = 50;
|
||||
this.efficiency = 12F;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.item.ItemGroup;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -59,18 +60,18 @@ public class ItemElectricTreetap extends Item implements IEnergyItemInfo {
|
|||
public int cost = 20;
|
||||
|
||||
public ItemElectricTreetap() {
|
||||
setMaxStackSize(1);
|
||||
super(new Item.Properties().maxStackSize(1));
|
||||
}
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
ForgePowerItemManager capEnergy = new ForgePowerItemManager(playerIn.getHeldItem(hand));
|
||||
public EnumActionResult onItemUse(ItemUseContext context) {
|
||||
IBlockState state = context.getWorld().getBlockState(context.getPos());
|
||||
ForgePowerItemManager capEnergy = new ForgePowerItemManager(context.getItem());
|
||||
if(TechRebornAPI.ic2Helper != null && capEnergy.getEnergyStored() >= cost){
|
||||
if(TechRebornAPI.ic2Helper.extractSap(playerIn, worldIn, pos, side, state, null) && !worldIn.isRemote){
|
||||
if(TechRebornAPI.ic2Helper.extractSap(context, null) && !context.getWorld().isRemote){
|
||||
capEnergy.extractEnergy(cost, false);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
|
||||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, context.getPlayer());
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -31,22 +31,25 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import reborncore.common.powerSystem.ExternalPowerSystems;
|
||||
import reborncore.common.powerSystem.forge.ForgePowerItemManager;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.tool.ItemChainsaw;
|
||||
import techreborn.utils.TagUtils;
|
||||
|
||||
public class ItemIndustrialChainsaw extends ItemChainsaw {
|
||||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemIndustrialChainsaw() {
|
||||
super(ToolMaterial.DIAMOND, ConfigTechReborn.IndustrialChainsawCharge, 1.0F);
|
||||
super(ItemTier.DIAMOND, ConfigTechReborn.IndustrialChainsawCharge, 1.0F);
|
||||
this.cost = 250;
|
||||
this.transferLimit = 1000;
|
||||
}
|
||||
|
@ -71,7 +74,8 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
for (int i = 1; i < 10; i++) {
|
||||
BlockPos nextPos = pos.up(i);
|
||||
IBlockState nextState = worldIn.getBlockState(nextPos);
|
||||
if(nextState.getBlock().isWood(worldIn, nextPos)){
|
||||
//TODO 1.13 use wood tag
|
||||
if(TagUtils.hasTag(nextState.getBlock(), Tags.Blocks.STORAGE_BLOCKS)){
|
||||
breakBlock(nextPos, stack, worldIn, entityLiving, pos);
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +109,7 @@ public class ItemIndustrialChainsaw extends ItemChainsaw {
|
|||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, entityLiving);
|
||||
|
||||
blockState.getBlock().harvestBlock(world, (EntityPlayer) entityLiving, pos, blockState, world.getTileEntity(pos), stack);
|
||||
world.setBlockToAir(pos);
|
||||
world.removeBlock(pos);
|
||||
world.removeTileEntity(pos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -53,7 +54,7 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemIndustrialDrill() {
|
||||
super(ToolMaterial.DIAMOND, ConfigTechReborn.IndustrialDrillCharge, 2.0F, 10F);
|
||||
super(ItemTier.DIAMOND, ConfigTechReborn.IndustrialDrillCharge, 2.0F, 10F);
|
||||
this.cost = 250;
|
||||
this.transferLimit = 1000;
|
||||
}
|
||||
|
@ -108,7 +109,7 @@ public class ItemIndustrialDrill extends ItemDrill {
|
|||
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
|
||||
|
||||
blockState.getBlock().harvestBlock(world, playerIn, pos, blockState, world.getTileEntity(pos), drill);
|
||||
world.setBlockToAir(pos);
|
||||
world.removeBlock(pos);
|
||||
world.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ package techreborn.items.tool.industrial;
|
|||
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -38,7 +39,7 @@ public class ItemIndustrialJackhammer extends ItemJackhammer {
|
|||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemIndustrialJackhammer() {
|
||||
super(ToolMaterial.IRON, ConfigTechReborn.IndustrialJackhammerCharge);
|
||||
super(ItemTier.IRON, ConfigTechReborn.IndustrialJackhammerCharge);
|
||||
this.cost = 250;
|
||||
this.efficiency = 60F;
|
||||
this.transferLimit = 1000;
|
||||
|
|
|
@ -28,16 +28,13 @@ import com.google.common.collect.HashMultimap;
|
|||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.IItemPropertyGetter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
@ -70,13 +67,11 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemNanosaber() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
setNoRepair();
|
||||
setMaxStackSize(1);
|
||||
super(ItemTier.DIAMOND, 1, 1, new Item.Properties().setNoRepair().maxStackSize(1));
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public float apply(ItemStack stack,
|
||||
public float call(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn,
|
||||
@Nullable
|
||||
|
@ -138,7 +133,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
if (stack.getTag() == null) {
|
||||
stack.setTag(new NBTTagCompound());
|
||||
}
|
||||
stack.getTag().setBoolean("isActive", true);
|
||||
stack.getTag().putBoolean("isActive", true);
|
||||
if (world.isRemote) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.format("techreborn.message.setTo") + " "
|
||||
|
@ -146,7 +141,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
.format("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
} else {
|
||||
stack.getTag().setBoolean("isActive", false);
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
if (world.isRemote) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.format("techreborn.message.setTo") + " "
|
||||
|
@ -161,7 +156,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (ItemUtils.isActive(stack) && new ForgePowerItemManager(stack).getEnergyStored() < cost) {
|
||||
if(worldIn.isRemote){
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||
|
@ -169,7 +164,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
+ TextFormatting.GOLD + I18n
|
||||
.format("techreborn.message.nanosaberDeactivating")));
|
||||
}
|
||||
stack.getTag().setBoolean("isActive", false);
|
||||
stack.getTag().putBoolean("isActive", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,17 +205,17 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
}
|
||||
ItemStack inactiveUncharged = new ItemStack(this);
|
||||
inactiveUncharged.setTag(new NBTTagCompound());
|
||||
inactiveUncharged.getTag().setBoolean("isActive", false);
|
||||
inactiveUncharged.getTag().putBoolean("isActive", false);
|
||||
|
||||
ItemStack inactiveCharged = new ItemStack(TRContent.NANOSABER);
|
||||
inactiveCharged.setTag(new NBTTagCompound());
|
||||
inactiveCharged.getTag().setBoolean("isActive", false);
|
||||
inactiveCharged.getTag().putBoolean("isActive", false);
|
||||
ForgePowerItemManager capEnergy = new ForgePowerItemManager(inactiveCharged);
|
||||
capEnergy.setEnergyStored(capEnergy.getMaxEnergyStored());
|
||||
|
||||
ItemStack activeCharged = new ItemStack(TRContent.NANOSABER);
|
||||
activeCharged.setTag(new NBTTagCompound());
|
||||
activeCharged.getTag().setBoolean("isActive", true);
|
||||
activeCharged.getTag().putBoolean("isActive", true);
|
||||
ForgePowerItemManager capEnergy2 = new ForgePowerItemManager(activeCharged);
|
||||
capEnergy2.setEnergyStored(capEnergy2.getMaxEnergyStored());
|
||||
|
||||
|
|
|
@ -26,12 +26,10 @@ package techreborn.items.tool.industrial;
|
|||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -64,10 +62,8 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo {
|
|||
|
||||
// 4M FE max charge with 1k charge rate
|
||||
public ItemOmniTool() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
super(ItemTier.DIAMOND, 1, 1, new Item.Properties().maxStackSize(1));
|
||||
efficiency = 13F;
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(200);
|
||||
}
|
||||
|
||||
// ItemPickaxe
|
||||
|
@ -124,9 +120,8 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo {
|
|||
|
||||
// Item
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(playerIn.getHeldItem(hand), playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||
public EnumActionResult onItemUse(ItemUseContext context) {
|
||||
return TorchHelper.placeTorch(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.items.tool.vanilla;
|
||||
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
@ -38,14 +39,14 @@ public class ItemTRAxe extends ItemAxe {
|
|||
}
|
||||
|
||||
public ItemTRAxe(IItemTier material, String repairOreDict) {
|
||||
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F);
|
||||
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Properties());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if (toRepair.getItem() == this && !repairOreDict.isEmpty()) {
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.items.tool.vanilla;
|
||||
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -40,20 +41,14 @@ public class ItemTRHoe extends ItemHoe {
|
|||
}
|
||||
|
||||
public ItemTRHoe(IItemTier material, String repairOreDict) {
|
||||
super(material);
|
||||
super(material, 1F, new Item.Properties());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if (toRepair.getItem() == this && !repairOreDict.isEmpty()) {
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
package techreborn.items.tool.vanilla;
|
||||
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
@ -32,19 +34,19 @@ public class ItemTRPickaxe extends ItemPickaxe {
|
|||
|
||||
String repairOreDict = "";
|
||||
|
||||
public ItemTRPickaxe(ToolMaterial material) {
|
||||
public ItemTRPickaxe(IItemTier material) {
|
||||
this(material, "");
|
||||
}
|
||||
|
||||
public ItemTRPickaxe(ToolMaterial material, String repairOreDict) {
|
||||
super(material);
|
||||
public ItemTRPickaxe(IItemTier material, String repairOreDict) {
|
||||
super(material, 1, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Properties());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if (toRepair.getItem() == this && !repairOreDict.isEmpty()) {
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, true, false, true);
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, true, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.items.tool.vanilla;
|
||||
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
@ -38,14 +39,14 @@ public class ItemTRSpade extends ItemSpade {
|
|||
}
|
||||
|
||||
public ItemTRSpade(IItemTier material, String repairOreDict) {
|
||||
super(material);
|
||||
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Properties());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if (toRepair.getItem() == this && !repairOreDict.isEmpty()) {
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package techreborn.items.tool.vanilla;
|
||||
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
@ -38,14 +39,14 @@ public class ItemTRSword extends ItemSword {
|
|||
}
|
||||
|
||||
public ItemTRSword(IItemTier material, String repairOreDict) {
|
||||
super(material);
|
||||
super(material, 1, (material.getAttackDamage() + 6.75F) * -0.344444F, new Item.Properties());
|
||||
this.repairOreDict = repairOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if (toRepair.getItem() == this && !repairOreDict.isEmpty()) {
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
|
|
|
@ -3,11 +3,21 @@ package techreborn.utils;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class FluidUtils {
|
||||
|
||||
public static Fluid fluidFromBlock(Block bLock){
|
||||
throw new UnsupportedOperationException("needs coding");
|
||||
}
|
||||
|
||||
public static List<Fluid> getAllFluids() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public static Fluid getFluid(String name){
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue