Auto Format code
This commit is contained in:
parent
112b1657cf
commit
796df6c055
503 changed files with 12260 additions and 16291 deletions
|
@ -15,7 +15,6 @@ import net.minecraft.util.EnumActionResult;
|
|||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
@ -26,7 +25,6 @@ import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack;
|
|||
import org.apache.commons.lang3.Validate;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.init.ModRecipes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -35,148 +33,149 @@ import java.util.List;
|
|||
*/
|
||||
public class DynamicCell extends Item {
|
||||
|
||||
public static final int CAPACITY = Fluid.BUCKET_VOLUME;
|
||||
public static final int CAPACITY = Fluid.BUCKET_VOLUME;
|
||||
|
||||
public DynamicCell() {
|
||||
super();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.cell");
|
||||
setMaxStackSize(16);
|
||||
}
|
||||
public DynamicCell() {
|
||||
super();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.cell");
|
||||
setMaxStackSize(16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(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?
|
||||
if(stack.hasTagCompound()) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if(tag.getSize() != 1 || tag.hasKey("Fluid")) {
|
||||
NBTTagCompound clearTag = new NBTTagCompound();
|
||||
clearTag.setTag("Fluid", tag.getCompoundTag("Fluid"));
|
||||
stack.setTagCompound(clearTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onUpdate(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?
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag.getSize() != 1 || tag.hasKey("Fluid")) {
|
||||
NBTTagCompound clearTag = new NBTTagCompound();
|
||||
clearTag.setTag("Fluid", tag.getCompoundTag("Fluid"));
|
||||
stack.setTagCompound(clearTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn, EnumHand hand) {
|
||||
if(!worldIn.isRemote) {
|
||||
RayTraceResult result = rayTrace(worldIn, playerIn, true);
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn, EnumHand hand) {
|
||||
if (!worldIn.isRemote) {
|
||||
RayTraceResult result = rayTrace(worldIn, playerIn, true);
|
||||
|
||||
if (result.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
BlockPos pos = result.getBlockPos();
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if (result.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
BlockPos pos = result.getBlockPos();
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (block instanceof IFluidBlock) {
|
||||
IFluidBlock fluidBlock = (IFluidBlock) block;
|
||||
if (block instanceof IFluidBlock) {
|
||||
IFluidBlock fluidBlock = (IFluidBlock) block;
|
||||
|
||||
if (fluidBlock.canDrain(worldIn, pos)) {
|
||||
FluidStack fluid = fluidBlock.drain(worldIn, pos, false);
|
||||
if (fluidBlock.canDrain(worldIn, pos)) {
|
||||
FluidStack fluid = fluidBlock.drain(worldIn, pos, false);
|
||||
|
||||
if (fluid != null && fluid.amount == DynamicCell.CAPACITY) {
|
||||
if(tryAddCellToInventory(playerIn, stack, fluid.getFluid())) {
|
||||
fluidBlock.drain(worldIn, pos, true);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
if (fluid != null && fluid.amount == DynamicCell.CAPACITY) {
|
||||
if (tryAddCellToInventory(playerIn, stack, fluid.getFluid())) {
|
||||
fluidBlock.drain(worldIn, pos, true);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else if (block instanceof BlockStaticLiquid) {
|
||||
Fluid fluid = block.getMaterial(state) == Material.LAVA ? FluidRegistry.LAVA : FluidRegistry.WATER;
|
||||
} else if (block instanceof BlockStaticLiquid) {
|
||||
Fluid fluid = block.getMaterial(state) == Material.LAVA ? FluidRegistry.LAVA : FluidRegistry.WATER;
|
||||
|
||||
if(tryAddCellToInventory(playerIn, stack, fluid)) {
|
||||
if(fluid != FluidRegistry.WATER)
|
||||
worldIn.setBlockToAir(pos);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
if (tryAddCellToInventory(playerIn, stack, fluid)) {
|
||||
if (fluid != FluidRegistry.WATER)
|
||||
worldIn.setBlockToAir(pos);
|
||||
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
public boolean tryAddCellToInventory(EntityPlayer player, ItemStack stack, Fluid fluid) {
|
||||
if (player.inventory.addItemStackToInventory(DynamicCell.getCellWithFluid(fluid))) {
|
||||
--stack.stackSize;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean tryAddCellToInventory(EntityPlayer player, ItemStack stack, Fluid fluid) {
|
||||
if (player.inventory.addItemStackToInventory(DynamicCell.getCellWithFluid(fluid))) {
|
||||
--stack.stackSize;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
subItems.add(getEmptyCell(1));
|
||||
for(Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
|
||||
subItems.add(getCellWithFluid(fluid));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
subItems.add(getEmptyCell(1));
|
||||
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
|
||||
subItems.add(getCellWithFluid(fluid));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
FluidStack fluidStack = getFluidHandler(stack).getFluid();
|
||||
if (fluidStack == null)
|
||||
return super.getItemStackDisplayName(stack);
|
||||
return fluidStack.getLocalizedName() + " Cell";
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
FluidStack fluidStack = getFluidHandler(stack).getFluid();
|
||||
if (fluidStack == null)
|
||||
return super.getItemStackDisplayName(stack);
|
||||
return fluidStack.getLocalizedName() + " Cell";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
|
||||
return getFluidHandler(stack);
|
||||
}
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
|
||||
return getFluidHandler(stack);
|
||||
}
|
||||
|
||||
public static FluidHandler getFluidHandler(ItemStack stack) {
|
||||
return new FluidHandler(stack, CAPACITY);
|
||||
}
|
||||
public static FluidHandler getFluidHandler(ItemStack stack) {
|
||||
return new FluidHandler(stack, CAPACITY);
|
||||
}
|
||||
|
||||
public static ItemStack getCellWithFluid(Fluid fluid, int stackSize){
|
||||
Validate.notNull(fluid);
|
||||
ItemStack stack = new ItemStack(ModItems.dynamicCell);
|
||||
getFluidHandler(stack).fill(new FluidStack(fluid, CAPACITY), true);
|
||||
stack.stackSize = stackSize;
|
||||
return stack;
|
||||
}
|
||||
public static ItemStack getCellWithFluid(Fluid fluid, int stackSize) {
|
||||
Validate.notNull(fluid);
|
||||
ItemStack stack = new ItemStack(ModItems.dynamicCell);
|
||||
getFluidHandler(stack).fill(new FluidStack(fluid, CAPACITY), true);
|
||||
stack.stackSize = stackSize;
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack getEmptyCell(int amount) {
|
||||
return new ItemStack(ModItems.dynamicCell, amount);
|
||||
}
|
||||
public static ItemStack getEmptyCell(int amount) {
|
||||
return new ItemStack(ModItems.dynamicCell, amount);
|
||||
}
|
||||
|
||||
public static ItemStack getCellWithFluid(Fluid fluid){
|
||||
return getCellWithFluid(fluid, 1);
|
||||
}
|
||||
public static ItemStack getCellWithFluid(Fluid fluid) {
|
||||
return getCellWithFluid(fluid, 1);
|
||||
}
|
||||
|
||||
public static class FluidHandler extends FluidHandlerItemStack {
|
||||
public static class FluidHandler extends FluidHandlerItemStack {
|
||||
|
||||
public FluidHandler(ItemStack container, int capacity) {
|
||||
super(container, capacity);
|
||||
public FluidHandler(ItemStack container, int capacity) {
|
||||
super(container, capacity);
|
||||
|
||||
//backwards compatibility
|
||||
if(container.hasTagCompound() && container.getTagCompound().hasKey("FluidName")) {
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTagCompound());
|
||||
if(stack != null) {
|
||||
container.setTagCompound(new NBTTagCompound());
|
||||
fill(stack, true);
|
||||
}
|
||||
}
|
||||
//backwards compatibility
|
||||
if (container.hasTagCompound() && container.getTagCompound().hasKey("FluidName")) {
|
||||
FluidStack stack = FluidStack.loadFluidStackFromNBT(container.getTagCompound());
|
||||
if (stack != null) {
|
||||
container.setTagCompound(new NBTTagCompound());
|
||||
fill(stack, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
if (resource.amount != capacity)
|
||||
return 0;
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
if(resource.amount != capacity) return 0;
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
if (maxDrain != capacity)
|
||||
return null;
|
||||
return super.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
if(maxDrain != capacity) return null;
|
||||
return super.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,25 +12,25 @@ import java.util.List;
|
|||
@Deprecated
|
||||
public class EmptyCell extends ItemTextureBase {
|
||||
|
||||
public EmptyCell() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.cell");
|
||||
}
|
||||
public EmptyCell() {
|
||||
super();
|
||||
setUnlocalizedName("techreborn.cell");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
tooltip.add("§cDeprecated");
|
||||
tooltip.add("§7Place to workbench to get new item");
|
||||
}
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
tooltip.add("§cDeprecated");
|
||||
tooltip.add("§7Place to workbench to get new item");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return ModInfo.MOD_ID + ":items/cell_base";
|
||||
}
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return ModInfo.MOD_ID + ":items/cell_base";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.items;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
@ -8,41 +7,36 @@ import org.apache.commons.lang3.Validate;
|
|||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
public class ItemCells
|
||||
{
|
||||
public class ItemCells {
|
||||
|
||||
@Deprecated
|
||||
public static final String[] types = new String[] { "Berylium", "biomass", "calciumCarbonate", "calcium", "carbon",
|
||||
"chlorine", "deuterium", "diesel", "ethanol", "glyceryl", "helium3", "helium", "heliumPlasma", "hydrogen",
|
||||
"ice", "lithium", "mercury", "methane", "nitrocarbon", "nitroCoalfuel", "nitroDiesel", "nitrogen",
|
||||
"nitrogenDioxide", "oil", "potassium", "seedOil", "silicon", "sodium", "sodiumPersulfate", "sodiumSulfide",
|
||||
"sulfur", "sulfuricAcid", "tritium", "wolframium", "empty", "lava", "water" };
|
||||
|
||||
"chlorine", "deuterium", "diesel", "ethanol", "glyceryl", "helium3", "helium", "heliumPlasma", "hydrogen",
|
||||
"ice", "lithium", "mercury", "methane", "nitrocarbon", "nitroCoalfuel", "nitroDiesel", "nitrogen",
|
||||
"nitrogenDioxide", "oil", "potassium", "seedOil", "silicon", "sodium", "sodiumPersulfate", "sodiumSulfide",
|
||||
"sulfur", "sulfuricAcid", "tritium", "wolframium", "empty", "lava", "water" };
|
||||
|
||||
@Deprecated
|
||||
public static ItemStack getCellByName(String name, int count, boolean lookForIC2)
|
||||
{
|
||||
public static ItemStack getCellByName(String name, int count, boolean lookForIC2) {
|
||||
return getCellByName(name, count);
|
||||
}
|
||||
|
||||
public static ItemStack getCellByName(String name, int count)
|
||||
{
|
||||
if(name.equalsIgnoreCase("empty") || name.equalsIgnoreCase("cell")){
|
||||
public static ItemStack getCellByName(String name, int count) {
|
||||
if (name.equalsIgnoreCase("empty") || name.equalsIgnoreCase("cell")) {
|
||||
return new ItemStack(ModItems.emptyCell, count);
|
||||
}
|
||||
Fluid fluid = FluidRegistry.getFluid("fluid" + name.toLowerCase());
|
||||
if(fluid == null) {
|
||||
if (fluid == null) {
|
||||
fluid = FluidRegistry.getFluid(name.toLowerCase());
|
||||
if(fluid == null) {
|
||||
if (fluid == null) {
|
||||
fluid = FluidRegistry.getFluid("fluid" + StringUtils.toFirstCapital(name.toLowerCase()));
|
||||
}
|
||||
}
|
||||
Validate.notNull(fluid, "The fluid " + name + " could not be found");
|
||||
Validate.notNull(fluid, "The fluid " + name + " could not be found");
|
||||
return DynamicCell.getCellWithFluid(fluid, count);
|
||||
}
|
||||
|
||||
public static ItemStack getCellByName(String name)
|
||||
{
|
||||
public static ItemStack getCellByName(String name) {
|
||||
return getCellByName(name, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,9 @@ import techreborn.Core;
|
|||
import techreborn.client.GuiHandler;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class ItemDestructopack extends ItemTextureBase implements ITexturedItem
|
||||
{
|
||||
public class ItemDestructopack extends ItemTextureBase implements ITexturedItem {
|
||||
|
||||
public ItemDestructopack()
|
||||
{
|
||||
public ItemDestructopack() {
|
||||
setUnlocalizedName("techreborn.destructopack");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
|
@ -24,22 +22,19 @@ public class ItemDestructopack extends ItemTextureBase implements ITexturedItem
|
|||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player,
|
||||
EnumHand hand)
|
||||
{
|
||||
EnumHand hand) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.destructoPackID, world, (int) player.posX, (int) player.posY,
|
||||
(int) player.posY);
|
||||
(int) player.posY);
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int arg0)
|
||||
{
|
||||
public String getTextureName(int arg0) {
|
||||
return "techreborn:items/misc/destructopack";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,64 +11,53 @@ import techreborn.lib.ModInfo;
|
|||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDusts extends ItemTextureBase
|
||||
{
|
||||
public class ItemDusts extends ItemTextureBase {
|
||||
public static final String[] types = new String[] { "almandine", "aluminum", "andradite", "ashes", "basalt",
|
||||
"bauxite", "brass", "bronze", "calcite", "charcoal", "chrome", "cinnabar", "clay", "coal", "copper",
|
||||
"darkAshes", "diamond", "electrum", "emerald", "enderEye", "enderPearl", "endstone", "flint", "galena",
|
||||
"gold", "grossular", "invar", "iron", "lazurite", "lead", "magnesium", "manganese", "marble", "netherrack",
|
||||
"nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "redGarnet", ModItems.META_PLACEHOLDER,
|
||||
"ruby", "saltpeter", "sapphire", "sawDust", "silver", "sodalite", "spessartine", "sphalerite", "steel",
|
||||
"sulfur", "tin", "titanium", "tungsten", "uvarovite", ModItems.META_PLACEHOLDER, "yellowGarnet", "zinc",
|
||||
"olivine", "andesite", "diorite", "granite" };
|
||||
"bauxite", "brass", "bronze", "calcite", "charcoal", "chrome", "cinnabar", "clay", "coal", "copper",
|
||||
"darkAshes", "diamond", "electrum", "emerald", "enderEye", "enderPearl", "endstone", "flint", "galena",
|
||||
"gold", "grossular", "invar", "iron", "lazurite", "lead", "magnesium", "manganese", "marble", "netherrack",
|
||||
"nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "redGarnet", ModItems.META_PLACEHOLDER,
|
||||
"ruby", "saltpeter", "sapphire", "sawDust", "silver", "sodalite", "spessartine", "sphalerite", "steel",
|
||||
"sulfur", "tin", "titanium", "tungsten", "uvarovite", ModItems.META_PLACEHOLDER, "yellowGarnet", "zinc",
|
||||
"olivine", "andesite", "diorite", "granite" };
|
||||
|
||||
public ItemDusts()
|
||||
{
|
||||
public ItemDusts() {
|
||||
setUnlocalizedName("techreborn.dust");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
|
||||
public static ItemStack getDustByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equalsIgnoreCase(name))
|
||||
{
|
||||
if(types[i].equals(ModItems.META_PLACEHOLDER)){
|
||||
public static ItemStack getDustByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
if (types[i].equals(ModItems.META_PLACEHOLDER)) {
|
||||
throw new InvalidParameterException("The dust " + name + " could not be found.");
|
||||
}
|
||||
return new ItemStack(ModItems.dusts, count, i);
|
||||
}
|
||||
}
|
||||
|
||||
if (name.equalsIgnoreCase("glowstone"))
|
||||
{
|
||||
if (name.equalsIgnoreCase("glowstone")) {
|
||||
return new ItemStack(Items.GLOWSTONE_DUST, count);
|
||||
}
|
||||
if (name.equalsIgnoreCase("redstone"))
|
||||
{
|
||||
if (name.equalsIgnoreCase("redstone")) {
|
||||
return new ItemStack(Items.REDSTONE, count);
|
||||
}
|
||||
if (name.equalsIgnoreCase("gunpowder"))
|
||||
{
|
||||
if (name.equalsIgnoreCase("gunpowder")) {
|
||||
return new ItemStack(Items.GUNPOWDER, count);
|
||||
}
|
||||
throw new InvalidParameterException("The dust " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getDustByName(String name)
|
||||
{
|
||||
public static ItemStack getDustByName(String name) {
|
||||
return getDustByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
|
@ -76,26 +65,24 @@ public class ItemDusts extends ItemTextureBase
|
|||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
if(!types[meta].equals(ModItems.META_PLACEHOLDER)){
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
if (!types[meta].equals(ModItems.META_PLACEHOLDER)) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
if(types[damage].equals("%NULL%")){
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
if (types[damage].equals("%NULL%")) {
|
||||
damage = 0;
|
||||
}
|
||||
return ModInfo.MOD_ID + ":items/dust/" + types[damage] + "Dust";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,32 +11,27 @@ import techreborn.lib.ModInfo;
|
|||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDustsSmall extends ItemTextureBase
|
||||
{
|
||||
public class ItemDustsSmall extends ItemTextureBase {
|
||||
|
||||
public static final String[] types = new String[] { "almandine", "aluminum", "andradite", "ashes", "basalt",
|
||||
"bauxite", "brass", "bronze", "calcite", "charcoal", "chrome", "cinnabar", "clay", "coal", "copper",
|
||||
"darkAshes", "diamond", "electrum", "emerald", "enderEye", "enderPearl", "endstone", "flint", "galena",
|
||||
"gold", "grossular", "invar", "iron", "lazurite", "lead", "magnesium", "manganese", "marble", "netherrack",
|
||||
"nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "redGarnet", ModItems.META_PLACEHOLDER,
|
||||
"ruby", "saltpeter", "sapphire", "sawDust", "silver", "sodalite", "spessartine", "sphalerite", "steel",
|
||||
"sulfur", "tin", "titanium", "tungsten", "uvarovite", ModItems.META_PLACEHOLDER, "yellowGarnet", "zinc",
|
||||
"olivine", "redstone", "glowstone", "andesite", "diorite", "granite" };
|
||||
"bauxite", "brass", "bronze", "calcite", "charcoal", "chrome", "cinnabar", "clay", "coal", "copper",
|
||||
"darkAshes", "diamond", "electrum", "emerald", "enderEye", "enderPearl", "endstone", "flint", "galena",
|
||||
"gold", "grossular", "invar", "iron", "lazurite", "lead", "magnesium", "manganese", "marble", "netherrack",
|
||||
"nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "redGarnet", ModItems.META_PLACEHOLDER,
|
||||
"ruby", "saltpeter", "sapphire", "sawDust", "silver", "sodalite", "spessartine", "sphalerite", "steel",
|
||||
"sulfur", "tin", "titanium", "tungsten", "uvarovite", ModItems.META_PLACEHOLDER, "yellowGarnet", "zinc",
|
||||
"olivine", "redstone", "glowstone", "andesite", "diorite", "granite" };
|
||||
|
||||
public ItemDustsSmall()
|
||||
{
|
||||
public ItemDustsSmall() {
|
||||
setUnlocalizedName("techreborn.dustsmall");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
|
||||
public static ItemStack getSmallDustByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equalsIgnoreCase(name))
|
||||
{
|
||||
if(types[i].equals(ModItems.META_PLACEHOLDER)){
|
||||
public static ItemStack getSmallDustByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
if (types[i].equals(ModItems.META_PLACEHOLDER)) {
|
||||
throw new InvalidParameterException("The small dust " + name + " could not be found.");
|
||||
}
|
||||
return new ItemStack(ModItems.smallDusts, count, i);
|
||||
|
@ -45,18 +40,15 @@ public class ItemDustsSmall extends ItemTextureBase
|
|||
throw new InvalidParameterException("The small dust " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getSmallDustByName(String name)
|
||||
{
|
||||
public static ItemStack getSmallDustByName(String name) {
|
||||
return getSmallDustByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
|
@ -64,28 +56,24 @@ public class ItemDustsSmall extends ItemTextureBase
|
|||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
if(!types[meta].equals(ModItems.META_PLACEHOLDER)){
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
if (!types[meta].equals(ModItems.META_PLACEHOLDER)) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
if(types[damage].equals(ModItems.META_PLACEHOLDER)){
|
||||
public String getTextureName(int damage) {
|
||||
if (types[damage].equals(ModItems.META_PLACEHOLDER)) {
|
||||
damage = 0;
|
||||
}
|
||||
return ModInfo.MOD_ID + ":items/smallDust/small" + StringUtils.toFirstCapital(types[damage]) + "Dust";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,65 +22,57 @@ import techreborn.lib.MessageIDs;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemFrequencyTransmitter extends ItemTextureBase implements ITexturedItem
|
||||
{
|
||||
public class ItemFrequencyTransmitter extends ItemTextureBase implements ITexturedItem {
|
||||
|
||||
public ItemFrequencyTransmitter()
|
||||
{
|
||||
public ItemFrequencyTransmitter() {
|
||||
setUnlocalizedName("techreborn.frequencyTransmitter");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setMaxStackSize(1);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
|
||||
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setInteger("x", pos.getX());
|
||||
stack.getTagCompound().setInteger("y", pos.getY());
|
||||
stack.getTagCompound().setInteger("z", pos.getZ());
|
||||
stack.getTagCompound().setInteger("dim", world.provider.getDimension());
|
||||
|
||||
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat)
|
||||
{
|
||||
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " X: " +
|
||||
TextFormatting.GOLD + pos.getX() +
|
||||
TextFormatting.GRAY + " Y: " +
|
||||
TextFormatting.GOLD + pos.getY() +
|
||||
TextFormatting.GRAY + " Z: " +
|
||||
TextFormatting.GOLD + pos.getZ() +
|
||||
TextFormatting.GRAY + " " + I18n.translateToLocal("techreborn.message.in") + " " +
|
||||
TextFormatting.GOLD + DimensionManager.getProviderType(world.provider.getDimension())
|
||||
.getName() + " (" + world.provider.getDimension() + ")"));
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " X: " +
|
||||
TextFormatting.GOLD + pos.getX() +
|
||||
TextFormatting.GRAY + " Y: " +
|
||||
TextFormatting.GOLD + pos.getY() +
|
||||
TextFormatting.GRAY + " Z: " +
|
||||
TextFormatting.GOLD + pos.getZ() +
|
||||
TextFormatting.GRAY + " " + I18n.translateToLocal("techreborn.message.in") + " " +
|
||||
TextFormatting.GOLD + DimensionManager.getProviderType(world.provider.getDimension())
|
||||
.getName() + " (" + world.provider.getDimension() + ")"));
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
||||
EnumHand hand)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
||||
EnumHand hand) {
|
||||
if (player.isSneaking()) {
|
||||
stack.setTagCompound(null);
|
||||
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat)
|
||||
{
|
||||
if (!world.isRemote && ConfigTechReborn.FreqTransmitterChat) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.coordsHaveBeen") + " "
|
||||
+ TextFormatting.GOLD + I18n.translateToLocal("techreborn.message.cleared")));
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.coordsHaveBeen") + " "
|
||||
+ TextFormatting.GOLD + I18n.translateToLocal("techreborn.message.cleared")));
|
||||
}
|
||||
}
|
||||
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (ConfigTechReborn.FreqTransmitterTooltip)
|
||||
{
|
||||
if (stack.getTagCompound() != null)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (ConfigTechReborn.FreqTransmitterTooltip) {
|
||||
if (stack.getTagCompound() != null) {
|
||||
int x = stack.getTagCompound().getInteger("x");
|
||||
int y = stack.getTagCompound().getInteger("y");
|
||||
int z = stack.getTagCompound().getInteger("z");
|
||||
|
@ -91,20 +83,19 @@ public class ItemFrequencyTransmitter extends ItemTextureBase implements ITextur
|
|||
list.add("X: " + z);
|
||||
list.add(TextFormatting.DARK_GRAY + DimensionManager.getProviderType(dim).getName());
|
||||
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.noCoordsSet"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int arg0)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int arg0) {
|
||||
return "techreborn:items/tool/frequency_transmitter";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -10,42 +7,37 @@ import techreborn.client.TechRebornCreativeTabMisc;
|
|||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
public class ItemGems extends ItemTextureBase
|
||||
{
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemGems extends ItemTextureBase {
|
||||
|
||||
public static final String[] types = new String[] { "ruby", "sapphire", "peridot", "redGarnet", "yellowGarnet" };
|
||||
|
||||
public ItemGems()
|
||||
{
|
||||
public ItemGems() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.gem");
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public static ItemStack getGemByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equalsIgnoreCase(name))
|
||||
{
|
||||
public static ItemStack getGemByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModItems.gems, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The gem " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getGemByName(String name)
|
||||
{
|
||||
public static ItemStack getGemByName(String name) {
|
||||
return getGemByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
|
@ -53,23 +45,19 @@ public class ItemGems extends ItemTextureBase
|
|||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return ModInfo.MOD_ID + ":items/gem/" + types[damage];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,44 +10,36 @@ import techreborn.lib.ModInfo;
|
|||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemIngots extends ItemTextureBase
|
||||
{
|
||||
public class ItemIngots extends ItemTextureBase {
|
||||
public static final String[] types = new String[] { "aluminum", "brass", "bronze", "chrome", "copper", "electrum",
|
||||
"invar", "iridium", "lead", "nickel", "platinum", "silver", "steel", "tin", "titanium", "tungsten",
|
||||
"hotTungstensteel", "tungstensteel", "zinc", "refinedIron", "advancedAlloy", "mixedMetal",
|
||||
"iridiumAlloy", "silicon" };
|
||||
"invar", "iridium", "lead", "nickel", "platinum", "silver", "steel", "tin", "titanium", "tungsten",
|
||||
"hotTungstensteel", "tungstensteel", "zinc", "refinedIron", "advancedAlloy", "mixedMetal",
|
||||
"iridiumAlloy", "silicon" };
|
||||
|
||||
public ItemIngots()
|
||||
{
|
||||
public ItemIngots() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.ingot");
|
||||
}
|
||||
|
||||
public static ItemStack getIngotByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equalsIgnoreCase(name))
|
||||
{
|
||||
public static ItemStack getIngotByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModItems.ingots, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The ingot " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getIngotByName(String name)
|
||||
{
|
||||
public static ItemStack getIngotByName(String name) {
|
||||
return getIngotByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
|
@ -55,23 +47,21 @@ public class ItemIngots extends ItemTextureBase
|
|||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
if(!types[meta].equals(ModItems.META_PLACEHOLDER)){
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
if (!types[meta].equals(ModItems.META_PLACEHOLDER)) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return ModInfo.MOD_ID + ":items/ingot/" + types[damage] + "Ingot";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,15 +5,13 @@ import reborncore.api.power.IEnergyItemInfo;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
public class ItemLapotronicOrb extends ItemTextureBase implements IEnergyItemInfo
|
||||
{
|
||||
public class ItemLapotronicOrb extends ItemTextureBase implements IEnergyItemInfo {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.LapotronicOrbMaxCharge;
|
||||
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
||||
public double transferLimit = 10000;
|
||||
|
||||
public ItemLapotronicOrb()
|
||||
{
|
||||
public ItemLapotronicOrb() {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(13);
|
||||
|
@ -22,44 +20,37 @@ public class ItemLapotronicOrb extends ItemTextureBase implements IEnergyItemInf
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/lapotronicEnergyOrb";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,23 +3,19 @@ package techreborn.items;
|
|||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class ItemMissingRecipe extends ItemTextureBase implements ITexturedItem
|
||||
{
|
||||
public ItemMissingRecipe()
|
||||
{
|
||||
public class ItemMissingRecipe extends ItemTextureBase implements ITexturedItem {
|
||||
public ItemMissingRecipe() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.missingrecipe");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/misc/missing_recipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -10,45 +10,37 @@ import techreborn.lib.ModInfo;
|
|||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemNuggets extends ItemTextureBase
|
||||
{
|
||||
public class ItemNuggets extends ItemTextureBase {
|
||||
|
||||
public static final String[] types = new String[] { "aluminum", "brass", "bronze", "chrome", "copper", "electrum",
|
||||
"invar", "iridium", "lead", "nickel", "platinum", "silver", "steel", "tin", "titanium", "tungsten",
|
||||
"hotTungstensteel", "tungstensteel", "zinc", "refinedIron", ModItems.META_PLACEHOLDER, ModItems.META_PLACEHOLDER,
|
||||
ModItems.META_PLACEHOLDER, "iron", "diamond" };
|
||||
"invar", "iridium", "lead", "nickel", "platinum", "silver", "steel", "tin", "titanium", "tungsten",
|
||||
"hotTungstensteel", "tungstensteel", "zinc", "refinedIron", ModItems.META_PLACEHOLDER, ModItems.META_PLACEHOLDER,
|
||||
ModItems.META_PLACEHOLDER, "iron", "diamond" };
|
||||
|
||||
public ItemNuggets()
|
||||
{
|
||||
public ItemNuggets() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.nuggets");
|
||||
}
|
||||
|
||||
public static ItemStack getNuggetByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equalsIgnoreCase(name))
|
||||
{
|
||||
public static ItemStack getNuggetByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModItems.nuggets, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The nugget " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getNuggetByName(String name)
|
||||
{
|
||||
public static ItemStack getNuggetByName(String name) {
|
||||
return getNuggetByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
|
@ -56,23 +48,21 @@ public class ItemNuggets extends ItemTextureBase
|
|||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
if(!types[meta].equals(ModItems.META_PLACEHOLDER)){
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
if (!types[meta].equals(ModItems.META_PLACEHOLDER)) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return ModInfo.MOD_ID + ":items/nuggets/" + types[damage] + "Nugget";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,48 +14,40 @@ import techreborn.lib.ModInfo;
|
|||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemParts extends ItemTextureBase
|
||||
{
|
||||
public class ItemParts extends ItemTextureBase {
|
||||
public static final String[] types = new String[] { "energyFlowCircuit", "dataControlCircuit", "dataStorageCircuit",
|
||||
"dataOrb", "diamondGrindingHead", "diamondSawBlade", "tungstenGrindingHead", "heliumCoolantSimple",
|
||||
"heliumCoolantTriple", "heliumCoolantSix", "NaKCoolantSimple", "NaKCoolantTriple", "NaKCoolantSix",
|
||||
"cupronickelHeatingCoil", "nichromeHeatingCoil", "kanthalHeatingCoil", ModItems.META_PLACEHOLDER, "superConductor",
|
||||
"thoriumCell", "doubleThoriumCell", "quadThoriumCell", "plutoniumCell", "doublePlutoniumCell",
|
||||
"quadPlutoniumCell", "computerMonitor", "machineParts", "neutronReflector", "iridiumNeutronReflector",
|
||||
"thickNeutronReflector", "electronicCircuit", "advancedCircuit", "rubberSap", "rubber", "scrap",
|
||||
"carbonmesh", "carbonfiber", "coolantSimple", "coolantTriple", "coolantSix" };
|
||||
"dataOrb", "diamondGrindingHead", "diamondSawBlade", "tungstenGrindingHead", "heliumCoolantSimple",
|
||||
"heliumCoolantTriple", "heliumCoolantSix", "NaKCoolantSimple", "NaKCoolantTriple", "NaKCoolantSix",
|
||||
"cupronickelHeatingCoil", "nichromeHeatingCoil", "kanthalHeatingCoil", ModItems.META_PLACEHOLDER, "superConductor",
|
||||
"thoriumCell", "doubleThoriumCell", "quadThoriumCell", "plutoniumCell", "doublePlutoniumCell",
|
||||
"quadPlutoniumCell", "computerMonitor", "machineParts", "neutronReflector", "iridiumNeutronReflector",
|
||||
"thickNeutronReflector", "electronicCircuit", "advancedCircuit", "rubberSap", "rubber", "scrap",
|
||||
"carbonmesh", "carbonfiber", "coolantSimple", "coolantTriple", "coolantSix" };
|
||||
|
||||
public ItemParts()
|
||||
{
|
||||
public ItemParts() {
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName("techreborn.part");
|
||||
}
|
||||
|
||||
public static ItemStack getPartByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equalsIgnoreCase(name))
|
||||
{
|
||||
public static ItemStack getPartByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModItems.parts, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getPartByName(String name)
|
||||
{
|
||||
public static ItemStack getPartByName(String name) {
|
||||
return getPartByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
|
@ -63,35 +55,31 @@ public class ItemParts extends ItemTextureBase
|
|||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
if(!types[meta].equals(ModItems.META_PLACEHOLDER)){
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
if (!types[meta].equals(ModItems.META_PLACEHOLDER)) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
{
|
||||
switch (itemStack.getItemDamage())
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
switch (itemStack.getItemDamage()) {
|
||||
case 37: // Destructo pack
|
||||
player.openGui(Core.INSTANCE, GuiHandler.destructoPackID, world, (int) player.posX, (int) player.posY,
|
||||
(int) player.posY);
|
||||
(int) player.posY);
|
||||
break;
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return ModInfo.MOD_ID + ":items/part/" + types[damage];
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return types.length;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,45 +12,37 @@ import techreborn.utils.OreDictUtils;
|
|||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemPlates extends ItemTextureBase
|
||||
{
|
||||
public class ItemPlates extends ItemTextureBase {
|
||||
|
||||
//Vanilla plates or plates not from ingots or gems
|
||||
public static String[] types = new String[] {
|
||||
"iron", "gold", "carbon", "wood", "redstone", "diamond", "emerald", "lapis", "coal", "obsidian", "lazurite"
|
||||
"iron", "gold", "carbon", "wood", "redstone", "diamond", "emerald", "lapis", "coal", "obsidian", "lazurite"
|
||||
};
|
||||
|
||||
public ItemPlates()
|
||||
{
|
||||
public ItemPlates() {
|
||||
setUnlocalizedName("techreborn.plate");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
|
||||
public static ItemStack getPlateByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equalsIgnoreCase(name))
|
||||
{
|
||||
public static ItemStack getPlateByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModItems.plate, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The plate " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getPlateByName(String name)
|
||||
{
|
||||
public static ItemStack getPlateByName(String name) {
|
||||
return getPlateByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
|
@ -58,17 +50,16 @@ public class ItemPlates extends ItemTextureBase
|
|||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerType(String plateType) {
|
||||
for (String type : types) {
|
||||
if (type.equals(plateType)) return;
|
||||
if (type.equals(plateType))
|
||||
return;
|
||||
}
|
||||
int plateIndex = types.length;
|
||||
String[] newTypes = new String[plateIndex + 1];
|
||||
|
@ -79,13 +70,13 @@ public class ItemPlates extends ItemTextureBase
|
|||
OreDictionary.registerOre(oreName, new ItemStack(ModItems.plate, 1, plateIndex));
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return ModInfo.MOD_ID + ":items/plate/" + types[damage] + "Plate";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,9 @@ import reborncore.RebornCore;
|
|||
import techreborn.api.ScrapboxList;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class ItemScrapBox extends ItemTextureBase implements ITexturedItem
|
||||
{
|
||||
public class ItemScrapBox extends ItemTextureBase implements ITexturedItem {
|
||||
|
||||
public ItemScrapBox()
|
||||
{
|
||||
public ItemScrapBox() {
|
||||
setUnlocalizedName("techreborn.scrapbox");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
|
@ -24,17 +22,15 @@ public class ItemScrapBox extends ItemTextureBase implements ITexturedItem
|
|||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStack, World world, EntityPlayer player,
|
||||
EnumHand hand)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
EnumHand hand) {
|
||||
if (!world.isRemote) {
|
||||
int random = world.rand.nextInt(ScrapboxList.stacks.size());
|
||||
ItemStack out = ScrapboxList.stacks.get(random).copy();
|
||||
float xOffset = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float yOffset = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float zOffset = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem = new EntityItem(world, player.getPosition().getX() + xOffset,
|
||||
player.getPosition().getY() + yOffset, player.getPosition().getZ() + zOffset, out);
|
||||
player.getPosition().getY() + yOffset, player.getPosition().getZ() + zOffset, out);
|
||||
|
||||
entityitem.setPickupDelay(20);
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
|
@ -45,14 +41,12 @@ public class ItemScrapBox extends ItemTextureBase implements ITexturedItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int arg0)
|
||||
{
|
||||
public String getTextureName(int arg0) {
|
||||
return "techreborn:items/misc/scrapBox";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,9 @@ import net.minecraft.item.Item;
|
|||
import reborncore.RebornCore;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class ItemTR extends Item
|
||||
{
|
||||
public class ItemTR extends Item {
|
||||
|
||||
public ItemTR()
|
||||
{
|
||||
public ItemTR() {
|
||||
setNoRepair();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
|
|
|
@ -3,11 +3,9 @@ package techreborn.items;
|
|||
import net.minecraft.item.Item;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
public class ItemTRNoDestroy extends Item
|
||||
{
|
||||
public class ItemTRNoDestroy extends Item {
|
||||
|
||||
public ItemTRNoDestroy()
|
||||
{
|
||||
public ItemTRNoDestroy() {
|
||||
setNoRepair();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
|
|
@ -6,12 +6,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
public abstract class ItemTextureBase extends ItemTR implements ITexturedItem
|
||||
{
|
||||
public abstract class ItemTextureBase extends ItemTR implements ITexturedItem {
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,24 +3,20 @@ package techreborn.items;
|
|||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
||||
public class ItemUUmatter extends ItemTextureBase implements ITexturedItem
|
||||
{
|
||||
public class ItemUUmatter extends ItemTextureBase implements ITexturedItem {
|
||||
|
||||
public ItemUUmatter()
|
||||
{
|
||||
public ItemUUmatter() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.uuMatter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/misc/itemMatter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,42 +15,34 @@ import techreborn.utils.upgrade.IMachineUpgrade;
|
|||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemUpgrades extends ItemTextureBase implements IMachineUpgrade, ITexturedItem
|
||||
{
|
||||
public class ItemUpgrades extends ItemTextureBase implements IMachineUpgrade, ITexturedItem {
|
||||
|
||||
public static final String[] types = new String[] { "Overclock", "Transformer", "EnergyStorage" };
|
||||
|
||||
public ItemUpgrades()
|
||||
{
|
||||
public ItemUpgrades() {
|
||||
setUnlocalizedName("techreborn.upgrade");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
}
|
||||
|
||||
public static ItemStack getUpgradeByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++)
|
||||
{
|
||||
if (types[i].equalsIgnoreCase(name))
|
||||
{
|
||||
public static ItemStack getUpgradeByName(String name, int count) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModItems.upgrades, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The upgrade " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getUpgradeByName(String name)
|
||||
{
|
||||
public static ItemStack getUpgradeByName(String name) {
|
||||
return getUpgradeByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= types.length)
|
||||
{
|
||||
if (meta < 0 || meta >= types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
|
@ -58,55 +50,46 @@ public class ItemUpgrades extends ItemTextureBase implements IMachineUpgrade, IT
|
|||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < types.length; ++meta)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
|
||||
for (int meta = 0; meta < types.length; ++meta) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processUpgrade(RecipeCrafter crafter, ItemStack stack)
|
||||
{
|
||||
public void processUpgrade(RecipeCrafter crafter, ItemStack stack) {
|
||||
// Remember the max speed multiplier can only be 0.99!!
|
||||
|
||||
if (stack.getItemDamage() == 0)
|
||||
{// Check the meta data here
|
||||
if (stack.getItemDamage() == 0) {// Check the meta data here
|
||||
crafter.addSpeedMulti(0.2);// This will set the speed multiplier to
|
||||
// 0.8
|
||||
// 0.8
|
||||
crafter.addPowerMulti(0.5);// This will use eu/tick x 1.5
|
||||
// crafter.addPowerMulti(2); This will use twice the amount of
|
||||
// power.
|
||||
}
|
||||
if (stack.getItemDamage() == 1)
|
||||
{
|
||||
if (stack.getItemDamage() == 1) {
|
||||
crafter.addPowerMulti(-0.2);// This will use eu/tick 0.8
|
||||
}
|
||||
if (stack.getItemDamage() == 2)
|
||||
{
|
||||
if (stack.getItemDamage() == 2) {
|
||||
crafter.addSpeedMulti(0.5);
|
||||
crafter.addPowerMulti(1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.wip"));
|
||||
tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.upBroken"));
|
||||
tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.ingredient"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return types.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/upgrade/upgrade"+types[damage];
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/upgrade/upgrade" + types[damage];
|
||||
}
|
||||
}
|
|
@ -21,15 +21,13 @@ import techreborn.lib.ModInfo;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITexturedItem
|
||||
{
|
||||
public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.LapotronPackCharge;
|
||||
public static final int tier = ConfigTechReborn.LapotronPackTier;
|
||||
public double transferLimit = 100000;
|
||||
|
||||
public ItemLapotronPack()
|
||||
{
|
||||
public ItemLapotronPack() {
|
||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.lapotronpack");
|
||||
|
@ -39,45 +37,38 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITex
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||
return "techreborn:" + "textures/models/lapotronpack.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
|
@ -87,21 +78,21 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITex
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
|
||||
if(player.inventory.getStackInSlot(i) != null){
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (player.inventory.getStackInSlot(i) != null) {
|
||||
ItemStack item = player.inventory.getStackInSlot(i);
|
||||
if(item.getItem() instanceof IEnergyItemInfo){
|
||||
if (item.getItem() instanceof IEnergyItemInfo) {
|
||||
IEnergyItemInfo energyItemInfo = (IEnergyItemInfo) item.getItem();
|
||||
if(energyItemInfo.getMaxPower(item) != PoweredItem.getEnergy(item)){
|
||||
if(PoweredItem.canUseEnergy(energyItemInfo.getMaxPower(item), itemStack)){
|
||||
if (energyItemInfo.getMaxPower(item) != PoweredItem.getEnergy(item)) {
|
||||
if (PoweredItem.canUseEnergy(energyItemInfo.getMaxPower(item), itemStack)) {
|
||||
PoweredItem.useEnergy(energyItemInfo.getMaxTransfer(item), itemStack);
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(item) + energyItemInfo.getMaxTransfer(item), item);
|
||||
}
|
||||
|
@ -112,28 +103,23 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITex
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/lapotronicPack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
|
|
|
@ -21,30 +21,29 @@ import techreborn.lib.ModInfo;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, ITexturedItem
|
||||
{
|
||||
public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.LithiumBatpackCharge;
|
||||
public static final int tier = ConfigTechReborn.LithiumBatpackTier;
|
||||
public double transferLimit = 10000;
|
||||
|
||||
public ItemLithiumBatpack()
|
||||
{
|
||||
public ItemLithiumBatpack() {
|
||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("techreborn.lithiumbatpack");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
|
||||
if(player.inventory.getStackInSlot(i) != null){
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (player.inventory.getStackInSlot(i) != null) {
|
||||
ItemStack item = player.inventory.getStackInSlot(i);
|
||||
if(item.getItem() instanceof IEnergyItemInfo){
|
||||
if (item.getItem() instanceof IEnergyItemInfo) {
|
||||
IEnergyItemInfo energyItemInfo = (IEnergyItemInfo) item.getItem();
|
||||
if(energyItemInfo.getMaxPower(item) != PoweredItem.getEnergy(item)){
|
||||
if(PoweredItem.canUseEnergy(energyItemInfo.getMaxPower(item), itemStack)){
|
||||
if (energyItemInfo.getMaxPower(item) != PoweredItem.getEnergy(item)) {
|
||||
if (PoweredItem.canUseEnergy(energyItemInfo.getMaxPower(item), itemStack)) {
|
||||
PoweredItem.useEnergy(energyItemInfo.getMaxTransfer(item), itemStack);
|
||||
PoweredItem.setEnergy(PoweredItem.getEnergy(item) + energyItemInfo.getMaxTransfer(item), item);
|
||||
}
|
||||
|
@ -53,47 +52,41 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, IT
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||
return "techreborn:" + "textures/models/lithiumbatpack.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
|
@ -103,37 +96,31 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, IT
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/lithiumBatpack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import reborncore.RebornCore;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
*/
|
||||
|
@ -22,13 +23,13 @@ public class ItemTRArmour extends ItemArmor implements ITexturedItem {
|
|||
public ItemTRArmour(ArmorMaterial material, EntityEquipmentSlot slot) {
|
||||
super(material, material.getDamageReductionAmount(slot), slot);
|
||||
if (slot == EntityEquipmentSlot.HEAD)
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Helmet");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Helmet");
|
||||
if (slot == EntityEquipmentSlot.CHEST)
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Chestplate");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Chestplate");
|
||||
if (slot == EntityEquipmentSlot.LEGS)
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Leggings");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Leggings");
|
||||
if (slot == EntityEquipmentSlot.FEET)
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Boots");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Boots");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material = material;
|
||||
|
|
|
@ -16,31 +16,30 @@ import techreborn.items.ItemTRNoDestroy;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemBattery extends ItemTRNoDestroy implements IEnergyItemInfo
|
||||
{
|
||||
public class ItemBattery extends ItemTRNoDestroy implements IEnergyItemInfo {
|
||||
|
||||
String name = "null";
|
||||
int maxEnergy = 0;
|
||||
int maxTransfer = 0;
|
||||
int tier = 0;
|
||||
|
||||
public ItemBattery(String name, int maxEnergy, int maxTransfer, int tier)
|
||||
{
|
||||
|
||||
public ItemBattery(String name, int maxEnergy, int maxTransfer, int tier) {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(1);
|
||||
setUnlocalizedName("techreborn."+name);
|
||||
this.name=name;
|
||||
this.maxEnergy=maxEnergy;
|
||||
this.maxTransfer=maxTransfer;
|
||||
this.tier=tier;
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn,
|
||||
@Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (stack != null && PoweredItem.getEnergy(stack) == 0.0)
|
||||
{
|
||||
setUnlocalizedName("techreborn." + name);
|
||||
this.name = name;
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.maxTransfer = maxTransfer;
|
||||
this.tier = tier;
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:empty"), new IItemPropertyGetter() {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn,
|
||||
@Nullable
|
||||
EntityLivingBase entityIn) {
|
||||
if (stack != null && PoweredItem.getEnergy(stack) == 0.0) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
|
@ -50,8 +49,7 @@ public class ItemBattery extends ItemTRNoDestroy implements IEnergyItemInfo
|
|||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
|
@ -61,46 +59,39 @@ public class ItemBattery extends ItemTRNoDestroy implements IEnergyItemInfo
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return maxTransfer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package techreborn.items.battery;
|
||||
|
||||
public class ItemReBattery extends ItemBattery
|
||||
{
|
||||
public class ItemReBattery extends ItemBattery {
|
||||
|
||||
public ItemReBattery()
|
||||
{
|
||||
public ItemReBattery() {
|
||||
super("rebattery", 10000, 64, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,31 +3,27 @@ package techreborn.items.tools;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemAdvancedChainsaw extends ItemChainsaw
|
||||
{
|
||||
|
||||
public ItemAdvancedChainsaw()
|
||||
{
|
||||
public class ItemAdvancedChainsaw extends ItemChainsaw {
|
||||
|
||||
public ItemAdvancedChainsaw() {
|
||||
super(ToolMaterial.DIAMOND, "techreborn.advancedChainsaw", ConfigTechReborn.AdvancedChainsawCharge,
|
||||
ConfigTechReborn.AdvancedDrillTier, 4.0F);
|
||||
ConfigTechReborn.AdvancedDrillTier, 4.0F);
|
||||
this.cost = 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState blockIn)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState blockIn) {
|
||||
return Items.DIAMOND_AXE.canHarvestBlock(blockIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/advancedChainsaw";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,31 +3,27 @@ package techreborn.items.tools;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemAdvancedDrill extends ItemDrill
|
||||
{
|
||||
|
||||
public ItemAdvancedDrill()
|
||||
{
|
||||
public class ItemAdvancedDrill extends ItemDrill {
|
||||
|
||||
public ItemAdvancedDrill() {
|
||||
super(ToolMaterial.DIAMOND, "techreborn.advancedDrill", ConfigTechReborn.AdvancedDrillCharge,
|
||||
ConfigTechReborn.AdvancedDrillTier, 4.0F, 20F);
|
||||
ConfigTechReborn.AdvancedDrillTier, 4.0F, 20F);
|
||||
this.cost = 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState blockIn)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState blockIn) {
|
||||
return Items.DIAMOND_PICKAXE.canHarvestBlock(blockIn) || Items.DIAMOND_SHOVEL.canHarvestBlock(blockIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/advancedDrill";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemAdvancedJackhammer extends ItemJackhammer
|
||||
{
|
||||
|
||||
public ItemAdvancedJackhammer()
|
||||
{
|
||||
public class ItemAdvancedJackhammer extends ItemJackhammer {
|
||||
|
||||
public ItemAdvancedJackhammer() {
|
||||
super(ToolMaterial.IRON, "techreborn.advancedJackhammer", ConfigTechReborn.AdvancedJackhammerCharge,
|
||||
ConfigTechReborn.AdvancedJackhammerTier);
|
||||
ConfigTechReborn.AdvancedJackhammerTier);
|
||||
this.cost = 250;
|
||||
this.efficiencyOnProperMaterial = 60F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/advancedJackhammer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.IHandHeld;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
|
@ -25,9 +23,9 @@ import reborncore.common.util.TorchHelper;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem , IHandHeld
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedItem, IHandHeld {
|
||||
|
||||
public static int tier = 1;
|
||||
public int maxCharge = 1;
|
||||
|
@ -36,8 +34,7 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
|||
public double transferLimit = 100;
|
||||
|
||||
public ItemChainsaw(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier,
|
||||
float unpoweredSpeed)
|
||||
{
|
||||
float unpoweredSpeed) {
|
||||
super(material);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -81,58 +78,49 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
|||
// }
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1)
|
||||
{
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
|
@ -142,35 +130,30 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/nullChainsaw";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
|
@ -17,73 +15,62 @@ import techreborn.client.TechRebornCreativeTab;
|
|||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.items.ItemTextureBase;
|
||||
|
||||
public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemInfo
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemInfo {
|
||||
public static int Teir = ConfigTechReborn.CloakingDeviceTier;
|
||||
public static int MaxCharge = ConfigTechReborn.CloakingDeviceCharge;
|
||||
public static int Limit = 100;
|
||||
public static boolean isActive;
|
||||
private int armorType = 1;
|
||||
|
||||
public ItemCloakingDevice()
|
||||
{
|
||||
public ItemCloakingDevice() {
|
||||
setUnlocalizedName("techreborn.cloakingdevice");
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
if (PoweredItem.canUseEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack))
|
||||
{
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
if (PoweredItem.canUseEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack)) {
|
||||
PoweredItem.useEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack);
|
||||
player.setInvisible(true);
|
||||
} else
|
||||
{
|
||||
if (!player.isPotionActive(MobEffects.INVISIBILITY))
|
||||
{
|
||||
} else {
|
||||
if (!player.isPotionActive(MobEffects.INVISIBILITY)) {
|
||||
player.setInvisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return MaxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return Limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return Teir;
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
ItemStack itemstack1 = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if (itemstack1 == null)
|
||||
{
|
||||
if (itemstack1 == null) {
|
||||
player.setItemStackToSlot(EntityEquipmentSlot.CHEST, itemStack.copy());
|
||||
itemStack.stackSize = 0;
|
||||
}
|
||||
|
@ -92,8 +79,7 @@ public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemIn
|
|||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
|
@ -102,27 +88,23 @@ public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemIn
|
|||
itemList.add(charged);
|
||||
}
|
||||
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/cloakingDevice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,39 +19,32 @@ import techreborn.items.ItemTextureBase;
|
|||
/**
|
||||
* Created by Mark on 20/03/2016.
|
||||
*/
|
||||
public class ItemDebugTool extends ItemTextureBase implements ITexturedItem
|
||||
{
|
||||
public class ItemDebugTool extends ItemTextureBase implements ITexturedItem {
|
||||
|
||||
public ItemDebugTool()
|
||||
{
|
||||
public ItemDebugTool() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.debug");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/misc/debug";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof IEnergyInterfaceTile)
|
||||
{
|
||||
if (!tile.getWorld().isRemote)
|
||||
{
|
||||
if (tile instanceof IEnergyInterfaceTile) {
|
||||
if (!tile.getWorld().isRemote) {
|
||||
playerIn.addChatComponentMessage(
|
||||
new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE
|
||||
+ PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
|
||||
new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE
|
||||
+ PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -4,32 +4,26 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.init.Items;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemDiamondChainsaw extends ItemChainsaw
|
||||
{
|
||||
public class ItemDiamondChainsaw extends ItemChainsaw {
|
||||
|
||||
public ItemDiamondChainsaw()
|
||||
{
|
||||
public ItemDiamondChainsaw() {
|
||||
super(ToolMaterial.DIAMOND, "techreborn.diamondChainsaw", ConfigTechReborn.DiamondChainsawCharge,
|
||||
ConfigTechReborn.DiamondChainsawTier, 2.5F);
|
||||
ConfigTechReborn.DiamondChainsawTier, 2.5F);
|
||||
this.cost = 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState blockIn)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState blockIn) {
|
||||
return Items.DIAMOND_AXE.canHarvestBlock(blockIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/diamondChainsaw";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,32 +4,26 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.init.Items;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemDiamondDrill extends ItemDrill
|
||||
{
|
||||
public class ItemDiamondDrill extends ItemDrill {
|
||||
|
||||
public ItemDiamondDrill()
|
||||
{
|
||||
public ItemDiamondDrill() {
|
||||
super(ToolMaterial.DIAMOND, "techreborn.diamondDrill", ConfigTechReborn.DiamondDrillCharge,
|
||||
ConfigTechReborn.DiamondDrillTier, 0.5F, 15F);
|
||||
ConfigTechReborn.DiamondDrillTier, 0.5F, 15F);
|
||||
this.cost = 250;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
return Items.DIAMOND_PICKAXE.canHarvestBlock(state) || Items.DIAMOND_SHOVEL.canHarvestBlock(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/diamondDrill";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemDiamondJackhammer extends ItemJackhammer
|
||||
{
|
||||
|
||||
public ItemDiamondJackhammer()
|
||||
{
|
||||
public class ItemDiamondJackhammer extends ItemJackhammer {
|
||||
|
||||
public ItemDiamondJackhammer() {
|
||||
super(ToolMaterial.DIAMOND, "techreborn.diamondJackhammer", ConfigTechReborn.DiamondJackhammerCharge,
|
||||
ConfigTechReborn.DiamondJackhammerTier);
|
||||
ConfigTechReborn.DiamondJackhammerTier);
|
||||
this.cost = 100;
|
||||
this.efficiencyOnProperMaterial = 16F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/diamondJackhammer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,9 +30,7 @@ import techreborn.lib.ModInfo;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem , IHandHeld
|
||||
{
|
||||
public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem, IHandHeld {
|
||||
|
||||
public static int tier = 1;
|
||||
public int maxCharge = 1;
|
||||
|
@ -40,8 +38,7 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
|||
public float unpoweredSpeed = 2.0F;
|
||||
public double transferLimit = 100;
|
||||
|
||||
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed, float efficiencyOnProperMaterial)
|
||||
{
|
||||
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier, float unpoweredSpeed, float efficiencyOnProperMaterial) {
|
||||
super(material);
|
||||
this.efficiencyOnProperMaterial = efficiencyOnProperMaterial;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -54,78 +51,75 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
|||
this.unpoweredSpeed = unpoweredSpeed;
|
||||
}
|
||||
|
||||
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving)
|
||||
{
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0)
|
||||
{
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0) {
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
if (!PoweredItem.canUseEnergy(cost, stack))
|
||||
{
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
if (!PoweredItem.canUseEnergy(cost, stack)) {
|
||||
return unpoweredSpeed;
|
||||
}
|
||||
if (Items.WOODEN_PICKAXE.getStrVsBlock(stack, state) > 1.0F
|
||||
|| Items.WOODEN_SHOVEL.getStrVsBlock(stack, state) > 1.0F)
|
||||
{
|
||||
|| Items.WOODEN_SHOVEL.getStrVsBlock(stack, state) > 1.0F) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return super.getStrVsBlock(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
||||
EntityLivingBase entityliving1)
|
||||
{
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
||||
EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override public boolean isRepairable()
|
||||
{
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override public int getStackTier(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
|
@ -134,31 +128,32 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
|||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/nullDrill";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining)
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,17 +31,14 @@ import techreborn.utils.OreDictUtils;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem , IHandHeld
|
||||
{
|
||||
public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem, IHandHeld {
|
||||
|
||||
public static int tier = 1;
|
||||
public int maxCharge = 1;
|
||||
public int cost = 250;
|
||||
public double transferLimit = 100;
|
||||
|
||||
public ItemJackhammer(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier)
|
||||
{
|
||||
public ItemJackhammer(ToolMaterial material, String unlocalizedName, int energyCapacity, int tier) {
|
||||
super(material);
|
||||
efficiencyOnProperMaterial = 20F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -53,86 +50,75 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
|
|||
this.tier = tier;
|
||||
}
|
||||
|
||||
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving)
|
||||
{
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0)
|
||||
{
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(34), stack) + 1) == 0) {
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
// TODO needs // FIXME: 13/03/2016
|
||||
return OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
if ((OreDictUtils.isOre(state, "stone") || state.getBlock() == Blocks.STONE) && PoweredItem.canUseEnergy(cost, stack)) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else {
|
||||
return 0.5F;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
if ((OreDictUtils.isOre(state, "stone") || state.getBlock() == Blocks.STONE) && PoweredItem.canUseEnergy(cost, stack)) {
|
||||
return efficiencyOnProperMaterial;
|
||||
} else {
|
||||
return 0.5F;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1)
|
||||
{
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return transferLimit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
|
@ -142,10 +128,8 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
if (PoweredItem.getEnergy(stack) > getMaxPower(stack))
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
if (PoweredItem.getEnergy(stack) > getMaxPower(stack)) {
|
||||
return 0;
|
||||
}
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
|
@ -154,27 +138,23 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/nullJackhammer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,25 +34,24 @@ import techreborn.lib.MessageIDs;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
||||
{
|
||||
public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
||||
public int cost = 250;
|
||||
|
||||
public ItemNanosaber()
|
||||
{
|
||||
public ItemNanosaber() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
setNoRepair();
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(1);
|
||||
setUnlocalizedName("techreborn.nanosaber");
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter()
|
||||
{
|
||||
@SideOnly(Side.CLIENT) public float apply(ItemStack stack, @Nullable World worldIn,
|
||||
@Nullable EntityLivingBase entityIn)
|
||||
{
|
||||
if (stack != null && stack.getTagCompound().getBoolean("isActive"))
|
||||
{
|
||||
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float apply(ItemStack stack,
|
||||
@Nullable
|
||||
World worldIn,
|
||||
@Nullable
|
||||
EntityLivingBase entityIn) {
|
||||
if (stack != null && stack.getTagCompound().getBoolean("isActive")) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
|
@ -60,40 +59,38 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
|||
});
|
||||
}
|
||||
|
||||
@Override public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot,
|
||||
ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot,
|
||||
ItemStack stack) {
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
int modifier = 0;
|
||||
if (stack.getTagCompound().getBoolean("isActive"))
|
||||
modifier = 9;
|
||||
|
||||
if (slot == EntityEquipmentSlot.MAINHAND)
|
||||
{
|
||||
if (slot == EntityEquipmentSlot.MAINHAND) {
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(),
|
||||
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.getAttributeUnlocalizedName(),
|
||||
new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
|
||||
new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
|
||||
}
|
||||
return multimap;
|
||||
}
|
||||
|
||||
@Override public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
||||
EntityLivingBase entityliving1)
|
||||
{
|
||||
if (PoweredItem.canUseEnergy(cost, itemstack))
|
||||
{
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving,
|
||||
EntityLivingBase entityliving1) {
|
||||
if (PoweredItem.canUseEnergy(cost, itemstack)) {
|
||||
PoweredItem.useEnergy(cost, itemstack);
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack inactiveUncharged = new ItemStack(ModItems.nanosaber);
|
||||
inactiveUncharged.setTagCompound(new NBTTagCompound());
|
||||
inactiveUncharged.getTagCompound().setBoolean("isActive", false);
|
||||
|
@ -118,92 +115,82 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo
|
|||
itemList.add(activeCharged);
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive"))
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
|
||||
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberInactive"));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
list.add(TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.nanosaberActive"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
||||
EnumHand hand)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive"))
|
||||
{
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player,
|
||||
EnumHand hand) {
|
||||
if (player.isSneaking()) {
|
||||
if (stack.getTagCompound() == null || !stack.getTagCompound().getBoolean("isActive")) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setBoolean("isActive", true);
|
||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat)
|
||||
{
|
||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||
+ TextFormatting.GOLD + I18n
|
||||
.translateToLocal("techreborn.message.nanosaberActive")));
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||
+ TextFormatting.GOLD + I18n
|
||||
.translateToLocal("techreborn.message.nanosaberActive")));
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
stack.getTagCompound().setBoolean("isActive", false);
|
||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat)
|
||||
{
|
||||
if (!world.isRemote && ConfigTechReborn.NanosaberChat) {
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.nanosaberID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||
+ TextFormatting.GOLD + I18n
|
||||
.translateToLocal("techreborn.message.nanosaberInactive")));
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " "
|
||||
+ TextFormatting.GOLD + I18n
|
||||
.translateToLocal("techreborn.message.nanosaberInactive")));
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
@Override public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
if (PoweredItem.getEnergy(stack) > getMaxPower(stack))
|
||||
{
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
if (PoweredItem.getEnergy(stack) > getMaxPower(stack)) {
|
||||
return 0;
|
||||
}
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override public boolean isRepairable()
|
||||
{
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return 100000;
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override public int getStackTier(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
|
@ -29,17 +27,16 @@ import techreborn.client.TechRebornCreativeTab;
|
|||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.OmniToolCharge;
|
||||
public static final int tier = ConfigTechReborn.OmniToolTier;
|
||||
public int cost = 100;
|
||||
public int hitCost = 125;
|
||||
|
||||
public ItemOmniTool()
|
||||
{
|
||||
public ItemOmniTool() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
efficiencyOnProperMaterial = 13F;
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -51,18 +48,16 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
|||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving)
|
||||
{
|
||||
EntityLivingBase entityLiving) {
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
return Items.DIAMOND_AXE.canHarvestBlock(state) || Items.DIAMOND_SWORD.canHarvestBlock(state)
|
||||
|| Items.DIAMOND_PICKAXE.canHarvestBlock(state) || Items.DIAMOND_SHOVEL.canHarvestBlock(state)
|
||||
|| Items.SHEARS.canHarvestBlock(state);
|
||||
|| Items.DIAMOND_PICKAXE.canHarvestBlock(state) || Items.DIAMOND_SHOVEL.canHarvestBlock(state)
|
||||
|| Items.SHEARS.canHarvestBlock(state);
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
@ -84,10 +79,8 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
|||
// }
|
||||
|
||||
@Override
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker)
|
||||
{
|
||||
if (PoweredItem.canUseEnergy(hitCost, itemstack))
|
||||
{
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
|
||||
if (PoweredItem.canUseEnergy(hitCost, itemstack)) {
|
||||
PoweredItem.useEnergy(hitCost, itemstack);
|
||||
entityliving.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), 8F);
|
||||
}
|
||||
|
@ -96,51 +89,43 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
|||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack itemStack)
|
||||
{
|
||||
public boolean canProvideEnergy(ItemStack itemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return 200;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack)
|
||||
{
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
|
@ -150,41 +135,35 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
|||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/omnitool";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
tooltip.add(TextFormatting.RED + "WIP Coming Soon");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,15 +27,13 @@ import techreborn.lib.ModInfo;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem
|
||||
{
|
||||
public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITexturedItem {
|
||||
|
||||
public static final int maxCharge = ConfigTechReborn.RockCutterCharge;
|
||||
public static final int tier = ConfigTechReborn.RockCutterTier;
|
||||
public int cost = 500;
|
||||
|
||||
public ItemRockCutter()
|
||||
{
|
||||
public ItemRockCutter() {
|
||||
super(ToolMaterial.DIAMOND);
|
||||
setUnlocalizedName("techreborn.rockcutter");
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
|
@ -44,85 +42,82 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITex
|
|||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
|
||||
@Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving)
|
||||
{
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos,
|
||||
EntityLivingBase entityLiving) {
|
||||
Random rand = new Random();
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, stack) + 1) == 0)
|
||||
{
|
||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
|
||||
PoweredItem.useEnergy(cost, stack);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
if (Items.DIAMOND_PICKAXE.canHarvestBlock(state))
|
||||
{
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
if (Items.DIAMOND_PICKAXE.canHarvestBlock(state)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public int getHarvestLevel(ItemStack stack, String toolClass)
|
||||
{
|
||||
@Override
|
||||
public int getHarvestLevel(ItemStack stack, String toolClass) {
|
||||
|
||||
if (!stack.isItemEnchanted())
|
||||
{
|
||||
if (!stack.isItemEnchanted()) {
|
||||
stack.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
|
||||
}
|
||||
|
||||
return super.getHarvestLevel(stack, toolClass);
|
||||
}
|
||||
|
||||
@Override public float getStrVsBlock(ItemStack stack, IBlockState state)
|
||||
{
|
||||
if (!PoweredItem.canUseEnergy(cost, stack))
|
||||
{
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
if (!PoweredItem.canUseEnergy(cost, stack)) {
|
||||
return 2F;
|
||||
}else{
|
||||
} else {
|
||||
return Items.DIAMOND_PICKAXE.getStrVsBlock(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean isRepairable()
|
||||
{
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn)
|
||||
{
|
||||
@Override
|
||||
public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) {
|
||||
stack.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
}
|
||||
|
||||
@Override public double getMaxPower(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxPower(ItemStack stack) {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override public boolean canAcceptEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canAcceptEnergy(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean canProvideEnergy(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean canProvideEnergy(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public double getMaxTransfer(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getMaxTransfer(ItemStack stack) {
|
||||
return 200;
|
||||
}
|
||||
|
||||
@Override public int getStackTier(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public int getStackTier(ItemStack stack) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList)
|
||||
{
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item,
|
||||
CreativeTabs par2CreativeTabs, List itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemStack.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||
itemList.add(itemStack);
|
||||
|
@ -133,31 +128,32 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITex
|
|||
itemList.add(charged);
|
||||
}
|
||||
|
||||
@Override public double getDurabilityForDisplay(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public double getDurabilityForDisplay(ItemStack stack) {
|
||||
double charge = (PoweredItem.getEnergy(stack) / getMaxPower(stack));
|
||||
return 1 - charge;
|
||||
|
||||
}
|
||||
|
||||
@Override public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/rockcutter";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining)
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
|
|
|
@ -3,31 +3,27 @@ package techreborn.items.tools;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemSteelChainsaw extends ItemChainsaw
|
||||
{
|
||||
|
||||
public ItemSteelChainsaw()
|
||||
{
|
||||
public class ItemSteelChainsaw extends ItemChainsaw {
|
||||
|
||||
public ItemSteelChainsaw() {
|
||||
super(ToolMaterial.IRON, "techreborn.ironChainsaw", ConfigTechReborn.IronChainsawCharge,
|
||||
ConfigTechReborn.IronChainsawTier, 2.0F);
|
||||
ConfigTechReborn.IronChainsawTier, 2.0F);
|
||||
this.cost = 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
return Items.IRON_AXE.canHarvestBlock(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/steelChainsaw";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,31 +3,27 @@ package techreborn.items.tools;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemSteelDrill extends ItemDrill
|
||||
{
|
||||
|
||||
public ItemSteelDrill()
|
||||
{
|
||||
public class ItemSteelDrill extends ItemDrill {
|
||||
|
||||
public ItemSteelDrill() {
|
||||
super(ToolMaterial.IRON, "techreborn.ironDrill", ConfigTechReborn.IronDrillCharge,
|
||||
ConfigTechReborn.IronDrillTier, 0.5F, 10F);
|
||||
ConfigTechReborn.IronDrillTier, 0.5F, 10F);
|
||||
this.cost = 50;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state)
|
||||
{
|
||||
public boolean canHarvestBlock(IBlockState state) {
|
||||
return Items.IRON_PICKAXE.canHarvestBlock(state) || Items.IRON_SHOVEL.canHarvestBlock(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/steelDrill";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
public class ItemSteelJackhammer extends ItemJackhammer
|
||||
{
|
||||
|
||||
public ItemSteelJackhammer()
|
||||
{
|
||||
public class ItemSteelJackhammer extends ItemJackhammer {
|
||||
|
||||
public ItemSteelJackhammer() {
|
||||
super(ToolMaterial.DIAMOND, "techreborn.steelJackhammer", ConfigTechReborn.SteelJackhammerCharge,
|
||||
ConfigTechReborn.SteelJackhammerTier);
|
||||
ConfigTechReborn.SteelJackhammerTier);
|
||||
this.cost = 50;
|
||||
this.efficiencyOnProperMaterial = 12F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/steelJackhammer";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.IHandHeld;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -20,13 +17,14 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemTRAxe extends ItemTool implements ITexturedItem , IHandHeld {
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemTRAxe extends ItemTool implements ITexturedItem, IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.PLANKS, Blocks.BOOKSHELF,
|
||||
Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK,
|
||||
Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE });
|
||||
Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK,
|
||||
Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE });
|
||||
|
||||
public ItemTRAxe(ToolMaterial material) {
|
||||
super(material, EFFECTIVE_ON);
|
||||
|
@ -41,7 +39,7 @@ public class ItemTRAxe extends ItemTool implements ITexturedItem , IHandHeld {
|
|||
public float getStrVsBlock(ItemStack stack, IBlockState state) {
|
||||
Material material = state.getMaterial();
|
||||
return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE
|
||||
? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
|
||||
? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,41 +12,35 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemTRHoe extends ItemHoe implements ITexturedItem, IHandHeld
|
||||
{
|
||||
public class ItemTRHoe extends ItemHoe implements ITexturedItem, IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
|
||||
public ItemTRHoe(ToolMaterial material) {
|
||||
super(material);
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Hoe");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Hoe");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material=material;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_hoe";
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_hoe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
{
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,41 +12,35 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemTRPickaxe extends ItemPickaxe implements ITexturedItem , IHandHeld
|
||||
{
|
||||
public class ItemTRPickaxe extends ItemPickaxe implements ITexturedItem, IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
|
||||
public ItemTRPickaxe(ToolMaterial material) {
|
||||
super(material);
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Pickaxe");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Pickaxe");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material=material;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_pickaxe";
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_pickaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
{
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,41 +12,35 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemTRSpade extends ItemSpade implements ITexturedItem , IHandHeld
|
||||
{
|
||||
public class ItemTRSpade extends ItemSpade implements ITexturedItem, IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
|
||||
public ItemTRSpade(ToolMaterial material) {
|
||||
super(material);
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Spade");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Spade");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material=material;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_shovel";
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_shovel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
{
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,41 +12,35 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
public class ItemTRSword extends ItemSword implements ITexturedItem , IHandHeld
|
||||
{
|
||||
public class ItemTRSword extends ItemSword implements ITexturedItem, IHandHeld {
|
||||
private ToolMaterial material = ToolMaterial.WOOD;
|
||||
|
||||
|
||||
public ItemTRSword(ToolMaterial material) {
|
||||
super(material);
|
||||
setUnlocalizedName(material.name().toLowerCase()+"Sword");
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Sword");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
this.material=material;
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
return "techreborn:items/tool/"+material.name().toLowerCase()+"_sword";
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/" + material.name().toLowerCase() + "_sword";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D()
|
||||
{
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -16,11 +14,11 @@ import techreborn.client.GuiHandler;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.items.ItemTextureBase;
|
||||
|
||||
public class ItemTechManual extends ItemTextureBase implements ITexturedItem
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public ItemTechManual()
|
||||
{
|
||||
public class ItemTechManual extends ItemTextureBase implements ITexturedItem {
|
||||
|
||||
public ItemTechManual() {
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.manual");
|
||||
setMaxStackSize(1);
|
||||
|
@ -28,28 +26,24 @@ public class ItemTechManual extends ItemTextureBase implements ITexturedItem
|
|||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World world, EntityPlayer player,
|
||||
EnumHand hand)
|
||||
{
|
||||
EnumHand hand) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.manuelID, world, (int) player.posX, (int) player.posY,
|
||||
(int) player.posY);
|
||||
(int) player.posY);
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/manual";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
tooltip.add(TextFormatting.RED + I18n.translateToLocal("tooltip.wip"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,9 @@ import reborncore.RebornCore;
|
|||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
public class ItemTreeTap extends Item implements ITexturedItem
|
||||
{
|
||||
public class ItemTreeTap extends Item implements ITexturedItem {
|
||||
|
||||
public ItemTreeTap()
|
||||
{
|
||||
public ItemTreeTap() {
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(20);
|
||||
setUnlocalizedName("techreborn.treetap");
|
||||
|
@ -24,27 +22,23 @@ public class ItemTreeTap extends Item implements ITexturedItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack stack)
|
||||
{
|
||||
public boolean showDurabilityBar(ItemStack stack) {
|
||||
return stack.getMetadata() != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureName(int damage)
|
||||
{
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/treetap";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMeta()
|
||||
{
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import reborncore.common.IWrenchable;
|
||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||
import net.minecraft.block.BlockDynamicLiquid;
|
||||
import net.minecraft.block.BlockStaticLiquid;
|
||||
|
@ -21,15 +20,14 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import techreborn.blocks.fluid.BlockFluidBase;
|
||||
import techreborn.blocks.storage.BlockBatBox;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.compat.CompatManager;
|
||||
import techreborn.init.ModSounds;
|
||||
import techreborn.items.ItemTR;
|
||||
import techreborn.lib.ModInfo;
|
||||
import techreborn.tiles.storage.TileEnergyStorage;
|
||||
import techreborn.utils.IC2WrenchHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -39,41 +37,34 @@ import java.util.Random;
|
|||
/**
|
||||
* Created by modmuss50 on 26/02/2016.
|
||||
*/
|
||||
public class ItemWrench extends ItemTR implements ITexturedItem
|
||||
{
|
||||
public class ItemWrench extends ItemTR implements ITexturedItem {
|
||||
|
||||
public ItemWrench()
|
||||
{
|
||||
public ItemWrench() {
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setUnlocalizedName("techreborn.wrench");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
|
||||
{
|
||||
if(CompatManager.isIC2Loaded){
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||
if (CompatManager.isIC2Loaded) {
|
||||
EnumActionResult result = IC2WrenchHelper.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||
if(result == EnumActionResult.SUCCESS){
|
||||
if (result == EnumActionResult.SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (world.isAirBlock(pos))
|
||||
{
|
||||
if (world.isAirBlock(pos)) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile == null)
|
||||
{
|
||||
if (tile == null) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (!player.isSneaking() && !player.worldObj.isRemote)
|
||||
{
|
||||
if (tile instanceof TileMachineBase)
|
||||
{
|
||||
if (side != EnumFacing.DOWN && side != EnumFacing.UP)
|
||||
{
|
||||
if (!player.isSneaking() && !player.worldObj.isRemote) {
|
||||
if (tile instanceof TileMachineBase) {
|
||||
if (side != EnumFacing.DOWN && side != EnumFacing.UP) {
|
||||
((TileMachineBase) tile).setFacing(side);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
@ -82,60 +73,46 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||
}
|
||||
|
||||
@Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if (world.isAirBlock(pos))
|
||||
{
|
||||
if (world.isAirBlock(pos)) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile == null)
|
||||
{
|
||||
if (tile == null) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
if (player.isSneaking()) {
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
if (tile instanceof IInventory)
|
||||
{
|
||||
if (tile instanceof IInventory) {
|
||||
IInventory inventory = (IInventory) tile;
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
{
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||
|
||||
if (itemStack != null)
|
||||
{
|
||||
if (itemStack.stackSize > 0)
|
||||
{
|
||||
if (itemStack != null) {
|
||||
if (itemStack.stackSize > 0) {
|
||||
if (itemStack.getItem() instanceof ItemBlock)
|
||||
|
||||
if (!(((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase) || !(((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid)
|
||||
|| !(((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid))
|
||||
{
|
||||
|| !(((ItemBlock) itemStack.getItem()).block instanceof BlockDynamicLiquid)) {
|
||||
items.add(itemStack.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tile instanceof IWrenchable)
|
||||
{
|
||||
if (((IWrenchable) tile).wrenchCanRemove(player))
|
||||
{
|
||||
if (tile instanceof IWrenchable) {
|
||||
if (((IWrenchable) tile).wrenchCanRemove(player)) {
|
||||
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
||||
if (itemStack == null)
|
||||
{
|
||||
if (itemStack == null) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
items.add(itemStack);
|
||||
}
|
||||
if (!items.isEmpty())
|
||||
{
|
||||
for (ItemStack itemStack : items)
|
||||
{
|
||||
if (!items.isEmpty()) {
|
||||
for (ItemStack itemStack : items) {
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
|
@ -144,29 +121,26 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY,
|
||||
pos.getZ() + dZ, itemStack.copy());
|
||||
pos.getZ() + dZ, itemStack.copy());
|
||||
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
if (itemStack.hasTagCompound()) {
|
||||
entityItem.getEntityItem()
|
||||
.setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
.setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = rand.nextGaussian() * factor;
|
||||
entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = rand.nextGaussian() * factor;
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.playSound(null, player.posX, player.posY,
|
||||
player.posZ, ModSounds.dismantle,
|
||||
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||
if (!world.isRemote)
|
||||
{
|
||||
player.posZ, ModSounds.dismantle,
|
||||
SoundCategory.BLOCKS, 0.6F, 1F);
|
||||
if (!world.isRemote) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
|
@ -175,29 +149,30 @@ public class ItemWrench extends ItemTR implements ITexturedItem
|
|||
}
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
}else{
|
||||
} else {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String getTextureName(int damage)
|
||||
{
|
||||
@Override
|
||||
public String getTextureName(int damage) {
|
||||
return "techreborn:items/tool/wrench";
|
||||
}
|
||||
|
||||
@Override public int getMaxMeta()
|
||||
{
|
||||
@Override
|
||||
public int getMaxMeta() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining)
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player,
|
||||
int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT) public boolean isFull3D()
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue