MOre fixes for items. Down to 860
This commit is contained in:
parent
e513e20e5a
commit
e3be87d517
8 changed files with 38 additions and 39 deletions
|
@ -47,6 +47,7 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
||||||
import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack;
|
import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import reborncore.common.util.StringUtils;
|
import reborncore.common.util.StringUtils;
|
||||||
|
import techreborn.TechReborn;
|
||||||
import techreborn.events.TRRecipeHandler;
|
import techreborn.events.TRRecipeHandler;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
|
|
||||||
|
@ -58,8 +59,7 @@ public class DynamicCell extends Item {
|
||||||
public static final int CAPACITY = Fluid.BUCKET_VOLUME;
|
public static final int CAPACITY = Fluid.BUCKET_VOLUME;
|
||||||
|
|
||||||
public DynamicCell() {
|
public DynamicCell() {
|
||||||
super();
|
super(new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||||
setMaxStackSize(64);
|
|
||||||
TRRecipeHandler.hideEntry(this);
|
TRRecipeHandler.hideEntry(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
import techreborn.client.EGui;
|
import techreborn.client.EGui;
|
||||||
|
@ -37,11 +38,16 @@ import techreborn.client.EGui;
|
||||||
public class ItemDestructopack extends Item {
|
public class ItemDestructopack extends Item {
|
||||||
|
|
||||||
public ItemDestructopack() {
|
public ItemDestructopack() {
|
||||||
|
super(new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(final World world, final EntityPlayer player, final EnumHand hand) {
|
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);
|
if (world.isRemote) {
|
||||||
|
BlockPos pos = new BlockPos(player.posX, player.posY, player.posZ);
|
||||||
|
EGui.DESTRUCTOPACK.open(player, pos, world);
|
||||||
|
}
|
||||||
|
//TODO: Add server part
|
||||||
return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
|
return new ActionResult<>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import reborncore.client.hud.StackInfoElement;
|
import reborncore.client.hud.StackInfoElement;
|
||||||
import reborncore.common.util.ChatUtils;
|
import reborncore.common.util.ChatUtils;
|
||||||
|
import techreborn.TechReborn;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
import techreborn.utils.MessageIDs;
|
import techreborn.utils.MessageIDs;
|
||||||
|
|
||||||
|
@ -52,16 +53,13 @@ import java.util.List;
|
||||||
public class ItemFrequencyTransmitter extends Item {
|
public class ItemFrequencyTransmitter extends Item {
|
||||||
|
|
||||||
public ItemFrequencyTransmitter() {
|
public ItemFrequencyTransmitter() {
|
||||||
setMaxStackSize(1);
|
super(new Item.Properties().group(TechReborn.ITEMGROUP).maxStackSize(1));
|
||||||
this.addPropertyOverride(new ResourceLocation("techreborn", "coords"), new IItemPropertyGetter() {
|
this.addPropertyOverride(new ResourceLocation("techreborn", "coords"), new IItemPropertyGetter() {
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public float apply(ItemStack stack,
|
public float call(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
|
||||||
@Nullable
|
if (!stack.isEmpty() && stack.hasTag() && stack.getTag() != null && stack.getTag().hasKey("x")
|
||||||
World worldIn,
|
&& stack.getTag().hasKey("y") && stack.getTag().hasKey("z") && stack.getTag().hasKey("dim")) {
|
||||||
@Nullable
|
|
||||||
EntityLivingBase entityIn) {
|
|
||||||
if (!stack.isEmpty() && stack.hasTag() && stack.getTag() != null && stack.getTag().hasKey("x") && stack.getTag().hasKey("y") && stack.getTag().hasKey("z") && stack.getTag().hasKey("dim")) {
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
return 0.0F;
|
return 0.0F;
|
||||||
|
|
|
@ -37,7 +37,7 @@ import techreborn.client.EGui;
|
||||||
public class ItemManual extends Item {
|
public class ItemManual extends Item {
|
||||||
|
|
||||||
public ItemManual() {
|
public ItemManual() {
|
||||||
this.setMaxStackSize(1);
|
super(new Item.Properties().group(TechReborn.ITEMGROUP).maxStackSize(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,12 +34,14 @@ import net.minecraft.world.World;
|
||||||
import reborncore.api.recipe.IBaseRecipeType;
|
import reborncore.api.recipe.IBaseRecipeType;
|
||||||
import reborncore.api.recipe.RecipeHandler;
|
import reborncore.api.recipe.RecipeHandler;
|
||||||
import reborncore.common.util.WorldUtils;
|
import reborncore.common.util.WorldUtils;
|
||||||
|
import techreborn.TechReborn;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemScrapBox extends Item {
|
public class ItemScrapBox extends Item {
|
||||||
|
|
||||||
public ItemScrapBox() {
|
public ItemScrapBox() {
|
||||||
|
super(new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,19 +25,17 @@
|
||||||
package techreborn.items.tool;
|
package techreborn.items.tool;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemUseContext;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.text.TextComponentString;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
import reborncore.api.power.IEnergyInterfaceTile;
|
import reborncore.api.power.IEnergyInterfaceTile;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.powerSystem.PowerSystem;
|
||||||
|
import techreborn.TechReborn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Mark on 20/03/2016.
|
* Created by Mark on 20/03/2016.
|
||||||
|
@ -45,37 +43,37 @@ import reborncore.common.powerSystem.PowerSystem;
|
||||||
public class ItemDebugTool extends Item {
|
public class ItemDebugTool extends Item {
|
||||||
|
|
||||||
public ItemDebugTool() {
|
public ItemDebugTool() {
|
||||||
|
super(new Item.Properties().group(TechReborn.ITEMGROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand,
|
public EnumActionResult onItemUse(ItemUseContext context) {
|
||||||
EnumFacing facing, float hitX, float hitY, float hitZ) {
|
Block block = context.getWorld().getBlockState(context.getPos()).getBlock();
|
||||||
Block block = worldIn.getBlockState(pos).getBlock();
|
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
sendMessage(playerIn, worldIn, new TextComponentString(TextFormatting.GREEN + "Block Registry Name: "
|
sendMessage(context, new TextComponentString(TextFormatting.GREEN + "Block Registry Name: "
|
||||||
+ TextFormatting.BLUE + block.getRegistryName().toString()));
|
+ TextFormatting.BLUE + block.getRegistryName().toString()));
|
||||||
} else {
|
} else {
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntity tile = worldIn.getTileEntity(pos);
|
TileEntity tile = context.getWorld().getTileEntity(context.getPos());
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
sendMessage(playerIn, worldIn, new TextComponentString(
|
sendMessage(context, new TextComponentString(
|
||||||
TextFormatting.GREEN + "Tile Entity: " + TextFormatting.BLUE + tile.getDisplayName().toString()));
|
TextFormatting.GREEN + "Tile Entity: " + TextFormatting.BLUE + tile.getType().toString()));
|
||||||
}
|
}
|
||||||
if (tile instanceof IEnergyInterfaceTile) {
|
if (tile instanceof IEnergyInterfaceTile) {
|
||||||
sendMessage(playerIn, worldIn, new TextComponentString(TextFormatting.GREEN + "Power: "
|
sendMessage(context, new TextComponentString(TextFormatting.GREEN + "Power: "
|
||||||
+ TextFormatting.BLUE + PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
|
+ TextFormatting.BLUE + PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
|
||||||
} else if (tile.hasCapability(CapabilityEnergy.ENERGY, facing)) {
|
} else if (tile.getCapability(CapabilityEnergy.ENERGY, context.getPlacementHorizontalFacing()) != null) {
|
||||||
sendMessage(playerIn, worldIn, new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED
|
sendMessage(context, new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED
|
||||||
+ tile.getCapability(CapabilityEnergy.ENERGY, facing).getEnergyStored() + "FU"));
|
+ ((IEnergyStorage) tile.getCapability(CapabilityEnergy.ENERGY, context.getPlacementHorizontalFacing())).getEnergyStored() + "FU"));
|
||||||
}
|
}
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessage(EntityPlayer playerIn, World worldIn, TextComponentString string) {
|
private void sendMessage(ItemUseContext context, TextComponentString string) {
|
||||||
if (!worldIn.isRemote) {
|
if (!context.getWorld().isRemote) {
|
||||||
playerIn.sendMessage(string);
|
context.getPlayer().sendMessage(string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,17 +25,11 @@
|
||||||
package techreborn.items.tool;
|
package techreborn.items.tool;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import techreborn.TechReborn;
|
||||||
|
|
||||||
public class ItemTreeTap extends Item {
|
public class ItemTreeTap extends Item {
|
||||||
|
|
||||||
public ItemTreeTap() {
|
public ItemTreeTap() {
|
||||||
setMaxStackSize(1);
|
super(new Item.Properties().group(TechReborn.ITEMGROUP).maxStackSize(1).defaultMaxDamage(20));
|
||||||
setMaxDamage(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean showDurabilityBar(ItemStack stack) {
|
|
||||||
return stack.getMetadata() != 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import reborncore.api.IToolHandler;
|
import reborncore.api.IToolHandler;
|
||||||
|
import techreborn.TechReborn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 26/02/2016.
|
* Created by modmuss50 on 26/02/2016.
|
||||||
|
@ -40,7 +41,7 @@ import reborncore.api.IToolHandler;
|
||||||
public class ItemWrench extends Item implements IToolHandler {
|
public class ItemWrench extends Item implements IToolHandler {
|
||||||
|
|
||||||
public ItemWrench() {
|
public ItemWrench() {
|
||||||
setMaxStackSize(1);
|
super(new Item.Properties().group(TechReborn.ITEMGROUP).maxStackSize(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue