Its gets to main menu
This commit is contained in:
parent
cc0b762b56
commit
32f25a0141
35 changed files with 221 additions and 215 deletions
|
@ -49,7 +49,7 @@ import techreborn.world.TechRebornWorldGen;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCUIES, guiFactory = ModInfo.GUI_FACTORY_CLASS, acceptedMinecraftVersions = "[1.8.8,1.8.9]")
|
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCUIES, guiFactory = ModInfo.GUI_FACTORY_CLASS, acceptedMinecraftVersions = "[1.9]")
|
||||||
public class Core {
|
public class Core {
|
||||||
public static ConfigTechReborn config;
|
public static ConfigTechReborn config;
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,9 @@ public class BlockMachineCasing extends BlockMultiblockBase implements ITextured
|
||||||
return (Integer) state.getValue(METADATA);
|
return (Integer) state.getValue(METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockStateContainer() {
|
protected BlockStateContainer createBlockState() {
|
||||||
|
|
||||||
METADATA = PropertyInteger.create("Type", 0, types.length);
|
METADATA = PropertyInteger.create("type", 0, types.length);
|
||||||
return new BlockStateContainer(this, METADATA);
|
return new BlockStateContainer(this, METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,9 @@ public class BlockMachineFrame extends BaseBlock implements ITexturedBlock {
|
||||||
return state.getValue(METADATA);
|
return state.getValue(METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockStateContainer() {
|
protected BlockStateContainer createBlockState() {
|
||||||
|
|
||||||
METADATA = PropertyInteger.create("Type", 0, types.length -1);
|
METADATA = PropertyInteger.create("type", 0, types.length -1);
|
||||||
return new BlockStateContainer(this, METADATA);
|
return new BlockStateContainer(this, METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,9 +186,9 @@ public class BlockOre extends BaseBlock implements ITexturedBlock, IOreNameProvi
|
||||||
return state.getValue(METADATA);
|
return state.getValue(METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockStateContainer() {
|
protected BlockStateContainer createBlockState() {
|
||||||
|
|
||||||
METADATA = PropertyInteger.create("Type", 0, types.length -1);
|
METADATA = PropertyInteger.create("type", 0, types.length -1);
|
||||||
return new BlockStateContainer(this, METADATA);
|
return new BlockStateContainer(this, METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,9 +110,9 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProv
|
||||||
return state.getValue(METADATA);
|
return state.getValue(METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockStateContainer() {
|
protected BlockStateContainer createBlockState() {
|
||||||
|
|
||||||
METADATA = PropertyInteger.create("Type", 0, types.length -1);
|
METADATA = PropertyInteger.create("type", 0, types.length -1);
|
||||||
return new BlockStateContainer(this, METADATA);
|
return new BlockStateContainer(this, METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,9 +138,9 @@ public class BlockPlayerDetector extends BaseTileBlock implements ITexturedBlock
|
||||||
return (Integer) state.getValue(METADATA);
|
return (Integer) state.getValue(METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockStateContainer() {
|
protected BlockStateContainer createBlockState() {
|
||||||
|
|
||||||
METADATA = PropertyInteger.create("Type", 0, types.length -1);
|
METADATA = PropertyInteger.create("type", 0, types.length -1);
|
||||||
return new BlockStateContainer(this, METADATA);
|
return new BlockStateContainer(this, METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,9 @@ package techreborn.blocks;
|
||||||
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -28,14 +30,13 @@ public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRota
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
if (!playerIn.isSneaking())
|
if (!playerIn.isSneaking())
|
||||||
playerIn.openGui(Core.INSTANCE, GuiHandler.quantumChestID, worldIn, pos.getX(),
|
playerIn.openGui(Core.INSTANCE, GuiHandler.quantumChestID, worldIn, pos.getX(),
|
||||||
pos.getY(), pos.getZ());
|
pos.getY(), pos.getZ());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final String prefix = "techreborn:blocks/machine/";
|
private final String prefix = "techreborn:blocks/machine/";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,9 +18,9 @@ public class BlockReinforcedGlass extends BaseBlock implements ITexturedBlock {
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
setHardness(4.0F);
|
setHardness(4.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumWorldBlockLayer;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
@ -49,16 +49,15 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public BlockRenderLayer getBlockLayer()
|
||||||
public EnumWorldBlockLayer getBlockLayer()
|
|
||||||
{
|
{
|
||||||
return Blocks.leaves.getBlockLayer();
|
return this.leavesFancy ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube(IBlockState state)
|
||||||
{
|
{
|
||||||
return Blocks.leaves.isOpaqueCube();
|
return Blocks.leaves.isOpaqueCube(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFullCube()
|
public boolean isFullCube()
|
||||||
|
@ -87,7 +86,7 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockStateContainer()
|
protected BlockStateContainer createBlockState()
|
||||||
{
|
{
|
||||||
return new BlockStateContainer(this, new IProperty[] { CHECK_DECAY, DECAYABLE});
|
return new BlockStateContainer(this, new IProperty[] { CHECK_DECAY, DECAYABLE});
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
@ -28,21 +29,20 @@ import java.util.Random;
|
||||||
*/
|
*/
|
||||||
public class BlockRubberLog extends Block implements ITexturedBlock {
|
public class BlockRubberLog extends Block implements ITexturedBlock {
|
||||||
|
|
||||||
public static PropertyDirection SAP_SIDE = PropertyDirection.create("sapSide", EnumFacing.Plane.HORIZONTAL);
|
public static PropertyDirection SAP_SIDE = PropertyDirection.create("sapside", EnumFacing.Plane.HORIZONTAL);
|
||||||
public static PropertyBool HAS_SAP = PropertyBool.create("hasSap");
|
public static PropertyBool HAS_SAP = PropertyBool.create("hassap");
|
||||||
|
|
||||||
public BlockRubberLog() {
|
public BlockRubberLog() {
|
||||||
super(Material.wood);
|
super(Material.wood);
|
||||||
setUnlocalizedName("techreborn.rubberlog");
|
setUnlocalizedName("techreborn.rubberlog");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
this.setHardness(2.0F);
|
this.setHardness(2.0F);
|
||||||
this.setStepSound(soundTypeWood);
|
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
this.setDefaultState(this.getDefaultState().withProperty(SAP_SIDE, EnumFacing.NORTH).withProperty(HAS_SAP, false));
|
this.setDefaultState(this.getDefaultState().withProperty(SAP_SIDE, EnumFacing.NORTH).withProperty(HAS_SAP, false));
|
||||||
this.setTickRandomly(true);
|
this.setTickRandomly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockStateContainer() {
|
protected BlockStateContainer createBlockState() {
|
||||||
return new BlockStateContainer(this, SAP_SIDE, HAS_SAP);
|
return new BlockStateContainer(this, SAP_SIDE, HAS_SAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos) {
|
public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,9 +114,9 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
|
||||||
int j = i + 1;
|
int j = i + 1;
|
||||||
if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) {
|
if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) {
|
||||||
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) {
|
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) {
|
||||||
IBlockState IBlockState = worldIn.getBlockState(blockpos);
|
IBlockState state1 = worldIn.getBlockState(blockpos);
|
||||||
if (IBlockState.getBlock().isLeaves(worldIn, blockpos)) {
|
if (state1.getBlock().isLeaves(state1, worldIn, blockpos)) {
|
||||||
IBlockState.getBlock().beginLeavesDecay(worldIn, blockpos);
|
state1.getBlock().beginLeavesDecay(state1,worldIn, blockpos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,19 +136,20 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) {
|
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ);
|
super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
|
||||||
if(playerIn.getCurrentEquippedItem() != null && playerIn.getCurrentEquippedItem().getItem() instanceof ItemTreeTap)
|
if(playerIn.getHeldItem(EnumHand.MAIN_HAND) != null && playerIn.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemTreeTap)
|
||||||
if(state.getValue(HAS_SAP)){
|
if(state.getValue(HAS_SAP)){
|
||||||
if(state.getValue(SAP_SIDE) == side){
|
if(state.getValue(SAP_SIDE) == side){
|
||||||
worldIn.setBlockState(pos, state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.getHorizontal(0)));
|
worldIn.setBlockState(pos, state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.getHorizontal(0)));
|
||||||
worldIn.playSoundAtEntity(playerIn, "techreborn:sap_extract", 0.8F, 1F);
|
//TODO 1.9 sounds
|
||||||
|
//worldIn.playSoundAtEntity(playerIn, "techreborn:sap_extract", 0.8F, 1F);
|
||||||
if(!worldIn.isRemote){
|
if(!worldIn.isRemote){
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
BlockPos itemPos = pos.offset(side);
|
BlockPos itemPos = pos.offset(side);
|
||||||
EntityItem item = new EntityItem(worldIn, itemPos.getX(), itemPos.getY(), itemPos.getZ(), ItemParts.getPartByName("rubberSap").copy());
|
EntityItem item = new EntityItem(worldIn, itemPos.getX(), itemPos.getY(), itemPos.getZ(), ItemParts.getPartByName("rubberSap").copy());
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
playerIn.getCurrentEquippedItem().damageItem(1, playerIn);
|
playerIn.getHeldItem(EnumHand.MAIN_HAND).damageItem(1, playerIn);
|
||||||
item.motionX = rand.nextGaussian() * factor;
|
item.motionX = rand.nextGaussian() * factor;
|
||||||
item.motionY = rand.nextGaussian() * factor + 0.2F;
|
item.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||||
item.motionZ = rand.nextGaussian() * factor;
|
item.motionZ = rand.nextGaussian() * factor;
|
||||||
|
|
|
@ -19,7 +19,6 @@ public class BlockRubberPlank extends Block implements ITexturedBlock {
|
||||||
setUnlocalizedName("techreborn.rubberplank");
|
setUnlocalizedName("techreborn.rubberplank");
|
||||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||||
this.setHardness(2.0F);
|
this.setHardness(2.0F);
|
||||||
this.setStepSound(soundTypeWood);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -86,9 +86,9 @@ public class BlockStorage extends BaseBlock implements ITexturedBlock {
|
||||||
return state.getValue(METADATA);
|
return state.getValue(METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockStateContainer() {
|
protected BlockStateContainer createBlockState() {
|
||||||
|
|
||||||
METADATA = PropertyInteger.create("Type", 0, types.length -1);
|
METADATA = PropertyInteger.create("type", 0, types.length -1);
|
||||||
return new BlockStateContainer(this, METADATA);
|
return new BlockStateContainer(this, METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,9 +84,9 @@ public class BlockStorage2 extends BaseBlock implements ITexturedBlock {
|
||||||
return (Integer) state.getValue(METADATA);
|
return (Integer) state.getValue(METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockStateContainer() {
|
protected BlockStateContainer createBlockState() {
|
||||||
|
|
||||||
METADATA = PropertyInteger.create("Type", 0, types.length -1);
|
METADATA = PropertyInteger.create("type", 0, types.length -1);
|
||||||
return new BlockStateContainer(this, METADATA);
|
return new BlockStateContainer(this, METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock {
|
||||||
this.setDefaultState(this.getDefaultState().withProperty(ACTIVE, false));
|
this.setDefaultState(this.getDefaultState().withProperty(ACTIVE, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BlockStateContainer createBlockStateContainer() {
|
protected BlockStateContainer createBlockState() {
|
||||||
ACTIVE = PropertyBool.create("active");
|
ACTIVE = PropertyBool.create("active");
|
||||||
return new BlockStateContainer(this, ACTIVE);
|
return new BlockStateContainer(this, ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ItemEnergyCrystal extends ItemTextureBase implements IEnergyItemInf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ItemLapotronCrystal extends ItemTextureBase implements IEnergyItemI
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ItemLapotronicOrb extends ItemTextureBase implements IEnergyItemInf
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class ItemLithiumBattery extends ItemTextureBase implements IEnergyItemIn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class ItemReBattery extends ItemTextureBase implements IEnergyItemInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
package techreborn.items;
|
package techreborn.items;
|
||||||
|
|
||||||
|
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
|
||||||
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
|
// @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");
|
// return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ package techreborn.items.armor;
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemArmor;
|
import net.minecraft.item.ItemArmor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -24,17 +25,16 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITex
|
||||||
public double transferLimit = 100000;
|
public double transferLimit = 100000;
|
||||||
|
|
||||||
public ItemLapotronPack() {
|
public ItemLapotronPack() {
|
||||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, 1);
|
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setUnlocalizedName("techreborn.lapotronpack");
|
setUnlocalizedName("techreborn.lapotronpack");
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
RebornCore.jsonDestroyer.registerObject(this);
|
RebornCore.jsonDestroyer.registerObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||||
return "techreborn:" + "textures/models/lapotronpack.png";
|
return "techreborn:" + "textures/models/lapotronpack.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITex
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package techreborn.items.armor;
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemArmor;
|
import net.minecraft.item.ItemArmor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -23,7 +24,7 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, IT
|
||||||
public double transferLimit = 10000;
|
public double transferLimit = 10000;
|
||||||
|
|
||||||
public ItemLithiumBatpack() {
|
public ItemLithiumBatpack() {
|
||||||
super(ItemArmor.ArmorMaterial.DIAMOND, 7, 1);
|
super(ItemArmor.ArmorMaterial.DIAMOND, 7, EntityEquipmentSlot.CHEST);
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
setUnlocalizedName("techreborn.lithiumbatpack");
|
setUnlocalizedName("techreborn.lithiumbatpack");
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
|
@ -34,7 +35,7 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, IT
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||||
return "techreborn:" + "textures/models/lithiumbatpack.png";
|
return "techreborn:" + "textures/models/lithiumbatpack.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, IT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,31 +50,31 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
||||||
this.unpoweredSpeed = unpoweredSpeed;
|
this.unpoweredSpeed = unpoweredSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
// public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, EntityLivingBase entityLiving) {
|
||||||
Random rand = new Random();
|
// Random rand = new Random();
|
||||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack) + 1) == 0) {
|
// if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack) + 1) == 0) {
|
||||||
PoweredItem.useEnergy(cost, stack);
|
// PoweredItem.useEnergy(cost, stack);
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
// public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||||
if (!PoweredItem.canUseEnergy(cost, stack)) {
|
// if (!PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
return unpoweredSpeed;
|
// return unpoweredSpeed;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (OreDictUtils.isOre(state, "treeLeaves") && PoweredItem.canUseEnergy(cost, stack)) {
|
// if (OreDictUtils.isOre(state, "treeLeaves") && PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
return 40F;
|
// return 40F;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F) {
|
// if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F) {
|
||||||
return efficiencyOnProperMaterial;
|
// return efficiencyOnProperMaterial;
|
||||||
} else {
|
// } else {
|
||||||
return super.getDigSpeed(stack, state);
|
// return super.getDigSpeed(stack, state);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||||
|
@ -112,7 +112,7 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, ITexturedI
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ package techreborn.items.tools;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
|
@ -36,18 +38,12 @@ public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemIn
|
||||||
PoweredItem.useEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack);
|
PoweredItem.useEnergy(ConfigTechReborn.CloakingDeviceEUTick, itemStack);
|
||||||
player.setInvisible(true);
|
player.setInvisible(true);
|
||||||
} else {
|
} else {
|
||||||
if (!player.isPotionActive(Potion.invisibility)) {
|
if (!player.isPotionActive(MobEffects.invisibility)) {
|
||||||
player.setInvisible(false);
|
player.setInvisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) {
|
|
||||||
return armorType == this.armorType;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower(ItemStack stack) {
|
public double getMaxPower(ItemStack stack) {
|
||||||
return MaxCharge;
|
return MaxCharge;
|
||||||
|
@ -69,15 +65,15 @@ public class ItemCloakingDevice extends ItemTextureBase implements IEnergyItemIn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return Teir;
|
return Teir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||||
ItemStack itemstack1 = player.getCurrentArmor(3);
|
ItemStack itemstack1 = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||||
|
|
||||||
if (itemstack1 == null) {
|
if (itemstack1 == null) {
|
||||||
player.setCurrentItemOrArmor(3, itemStack.copy());
|
player.setItemStackToSlot(EntityEquipmentSlot.CHEST, itemStack.copy());
|
||||||
itemStack.stackSize = 0;
|
itemStack.stackSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package techreborn.items.tools;
|
package techreborn.items.tools;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
@ -8,13 +9,13 @@ import techreborn.config.ConfigTechReborn;
|
||||||
public class ItemDiamondDrill extends ItemDrill {
|
public class ItemDiamondDrill extends ItemDrill {
|
||||||
|
|
||||||
public ItemDiamondDrill() {
|
public ItemDiamondDrill() {
|
||||||
super(ToolMaterial.EMERALD, "techreborn.diamondDrill", ConfigTechReborn.DiamondDrillCharge, ConfigTechReborn.DiamondDrillTier, 2.5F);
|
super(ToolMaterial.DIAMOND, "techreborn.diamondDrill", ConfigTechReborn.DiamondDrillCharge, ConfigTechReborn.DiamondDrillTier, 2.5F);
|
||||||
this.cost = 250;
|
this.cost = 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
return Items.diamond_pickaxe.canHarvestBlock(block, stack) || Items.diamond_shovel.canHarvestBlock(block, stack);
|
return Items.diamond_pickaxe.canHarvestBlock(state) || Items.diamond_shovel.canHarvestBlock(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,7 @@ import techreborn.config.ConfigTechReborn;
|
||||||
public class ItemDiamondJackhammer extends ItemJackhammer {
|
public class ItemDiamondJackhammer extends ItemJackhammer {
|
||||||
|
|
||||||
public ItemDiamondJackhammer() {
|
public ItemDiamondJackhammer() {
|
||||||
super(ToolMaterial.EMERALD, "techreborn.diamondJackhammer", ConfigTechReborn.DiamondJackhammerCharge, ConfigTechReborn.DiamondJackhammerTier);
|
super(ToolMaterial.DIAMOND, "techreborn.diamondJackhammer", ConfigTechReborn.DiamondJackhammerCharge, ConfigTechReborn.DiamondJackhammerTier);
|
||||||
this.cost = 250;
|
this.cost = 250;
|
||||||
this.efficiencyOnProperMaterial = 60F;
|
this.efficiencyOnProperMaterial = 60F;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemPickaxe;
|
import net.minecraft.item.ItemPickaxe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -47,26 +49,26 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
||||||
this.unpoweredSpeed = unpoweredSpeed;
|
this.unpoweredSpeed = unpoweredSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
// public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
||||||
Random rand = new Random();
|
// Random rand = new Random();
|
||||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack)+1) == 0) {
|
// if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack)+1) == 0) {
|
||||||
PoweredItem.useEnergy(cost, stack);
|
// PoweredItem.useEnergy(cost, stack);
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
// public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||||
if (!PoweredItem.canUseEnergy(cost, stack)) {
|
// if (!PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
return unpoweredSpeed;
|
// return unpoweredSpeed;
|
||||||
}
|
// }
|
||||||
if (Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F) {
|
// if (Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F) {
|
||||||
return efficiencyOnProperMaterial;
|
// return efficiencyOnProperMaterial;
|
||||||
} else {
|
// } else {
|
||||||
return super.getDigSpeed(stack, state);
|
// return super.getDigSpeed(stack, state);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||||
|
@ -74,8 +76,8 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
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, side, hitX, hitY, hitZ);
|
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -104,7 +106,7 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo, ITextured
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@ public class ItemHammer extends ItemTR implements ITexturedItem {
|
||||||
setMaxDamage(MaxDamage);
|
setMaxDamage(MaxDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
// public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
world.playSoundAtEntity(player, "techreborn:block_dismantle", 0.8F, 0.4F);
|
// world.playSoundAtEntity(player, "techreborn:block_dismantle", 0.8F, 0.4F);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item setUnlocalizedName(String par1Str) {
|
public Item setUnlocalizedName(String par1Str) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package techreborn.items.tools;
|
package techreborn.items.tools;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
@ -13,8 +14,8 @@ public class ItemIronChainsaw extends ItemChainsaw {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
return Items.iron_axe.canHarvestBlock(block, stack);
|
return Items.iron_axe.canHarvestBlock(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package techreborn.items.tools;
|
package techreborn.items.tools;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
@ -13,8 +14,8 @@ public class ItemIronDrill extends ItemDrill {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
return Items.iron_pickaxe.canHarvestBlock(block, stack) || Items.iron_shovel.canHarvestBlock(block, stack);
|
return Items.iron_pickaxe.canHarvestBlock(state) || Items.iron_shovel.canHarvestBlock(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,6 +11,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemPickaxe;
|
import net.minecraft.item.ItemPickaxe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -45,31 +47,32 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
// public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
||||||
Random rand = new Random();
|
// Random rand = new Random();
|
||||||
if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack) + 1) == 0) {
|
// if (rand.nextInt(EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack) + 1) == 0) {
|
||||||
PoweredItem.useEnergy(cost, stack);
|
// PoweredItem.useEnergy(cost, stack);
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
if (OreDictUtils.isOre(block, "stone") && PoweredItem.canUseEnergy(cost, stack)) {
|
//TODO needs // FIXME: 13/03/2016
|
||||||
|
if (OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost, null)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
// public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||||
if (OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost, stack)) {
|
// if (OreDictUtils.isOre(state, "stone") && PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
return efficiencyOnProperMaterial;
|
// return efficiencyOnProperMaterial;
|
||||||
} else {
|
// } else {
|
||||||
return 0.5F;
|
// return 0.5F;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
|
||||||
|
@ -77,8 +80,8 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
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, side, hitX, hitY, hitZ);
|
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,7 +110,7 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo, ITex
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo, ITextur
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return tier;
|
return tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemPickaxe;
|
import net.minecraft.item.ItemPickaxe;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -33,7 +35,7 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
||||||
public int hitCost = 125;
|
public int hitCost = 125;
|
||||||
|
|
||||||
public ItemOmniTool() {
|
public ItemOmniTool() {
|
||||||
super(ToolMaterial.EMERALD);
|
super(ToolMaterial.DIAMOND);
|
||||||
efficiencyOnProperMaterial = 13F;
|
efficiencyOnProperMaterial = 13F;
|
||||||
setCreativeTab(TechRebornCreativeTab.instance);
|
setCreativeTab(TechRebornCreativeTab.instance);
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
|
@ -43,37 +45,37 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) {
|
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, EntityLivingBase entityLiving) {
|
||||||
PoweredItem.useEnergy(cost, stack);
|
PoweredItem.useEnergy(cost, stack);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
return Items.diamond_axe.canHarvestBlock(block, stack)
|
return Items.diamond_axe.canHarvestBlock(state)
|
||||||
|| Items.diamond_sword.canHarvestBlock(block, stack)
|
|| Items.diamond_sword.canHarvestBlock(state)
|
||||||
|| Items.diamond_pickaxe.canHarvestBlock(block, stack)
|
|| Items.diamond_pickaxe.canHarvestBlock(state)
|
||||||
|| Items.diamond_shovel.canHarvestBlock(block, stack)
|
|| Items.diamond_shovel.canHarvestBlock(state)
|
||||||
|| Items.shears.canHarvestBlock(block, stack);
|
|| Items.shears.canHarvestBlock(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public float getDigSpeed(ItemStack stack, IBlockState state) {
|
// public float getDigSpeed(ItemStack stack, IBlockState state) {
|
||||||
if (PoweredItem.canUseEnergy(cost, stack)) {
|
// if (PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
PoweredItem.useEnergy(cost, stack);
|
// PoweredItem.useEnergy(cost, stack);
|
||||||
return 5.0F;
|
// return 5.0F;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F
|
// if (Items.wooden_axe.getDigSpeed(stack, state) > 1.0F
|
||||||
|| Items.wooden_sword.getDigSpeed(stack, state) > 1.0F
|
// || Items.wooden_sword.getDigSpeed(stack, state) > 1.0F
|
||||||
|| Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F
|
// || Items.wooden_pickaxe.getDigSpeed(stack, state) > 1.0F
|
||||||
|| Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F
|
// || Items.wooden_shovel.getDigSpeed(stack, state) > 1.0F
|
||||||
|| Items.shears.getDigSpeed(stack, state) > 1.0F) {
|
// || Items.shears.getDigSpeed(stack, state) > 1.0F) {
|
||||||
return efficiencyOnProperMaterial;
|
// return efficiencyOnProperMaterial;
|
||||||
} else {
|
// } else {
|
||||||
return super.getDigSpeed(stack, state);
|
// return super.getDigSpeed(stack, state);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
|
public boolean hitEntity(ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase attacker) {
|
||||||
|
@ -85,8 +87,8 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
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, side, hitX, hitY, hitZ);
|
return TorchHelper.placeTorch(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -116,7 +118,7 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo, ITextu
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package techreborn.items.tools;
|
||||||
|
|
||||||
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -50,40 +51,40 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITex
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHarvestBlock(Block block, ItemStack stack) {
|
public boolean canHarvestBlock(IBlockState state) {
|
||||||
if (Items.diamond_pickaxe.canHarvestBlock(block, stack)) {
|
if (Items.diamond_pickaxe.canHarvestBlock(state)) {
|
||||||
if (PoweredItem.canUseEnergy(cost, stack)) {
|
// if (PoweredItem.canUseEnergy(cost, stack)) {
|
||||||
PoweredItem.useEnergy(cost, stack);
|
// PoweredItem.useEnergy(cost, stack);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public int getHarvestLevel(ItemStack stack, String toolClass) {
|
// public int getHarvestLevel(ItemStack stack, String toolClass) {
|
||||||
if (!stack.isItemEnchanted()) {
|
// if (!stack.isItemEnchanted()) {
|
||||||
stack.addEnchantment(Enchantment.silkTouch, 1);
|
// stack.addEnchantment(Enchantment.silkTouch, 1);
|
||||||
}
|
// }
|
||||||
return super.getHarvestLevel(stack, toolClass);
|
// return super.getHarvestLevel(stack, toolClass);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public float getStrVsBlock(ItemStack stack, Block block) {
|
// public float getStrVsBlock(ItemStack stack, Block block) {
|
||||||
if (!stack.isItemEnchanted()) {
|
// if (!stack.isItemEnchanted()) {
|
||||||
stack.addEnchantment(Enchantment.silkTouch, 1);
|
// stack.addEnchantment(Enchantment.silkTouch, 1);
|
||||||
}
|
// }
|
||||||
return super.getStrVsBlock(stack, block);
|
// return super.getStrVsBlock(stack, block);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRepairable() {
|
public boolean isRepairable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
// public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||||
par1ItemStack.addEnchantment(Enchantment.silkTouch, 1);
|
// par1ItemStack.addEnchantment(Enchantment.silkTouch, 1);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,7 +108,7 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo, ITex
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStackTeir(ItemStack stack) {
|
public int getStackTier(ItemStack stack) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -34,17 +36,18 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
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) || !player.isSneaking()){
|
if(world.isAirBlock(pos) || !player.isSneaking()){
|
||||||
return false;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile == null){
|
if(tile == null){
|
||||||
return false;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
if(!(tile instanceof IInventory)){
|
if(!(tile instanceof IInventory)){
|
||||||
return false;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||||
|
@ -69,7 +72,7 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
|
||||||
if(((IWrenchable) tile).wrenchCanRemove(player)){
|
if(((IWrenchable) tile).wrenchCanRemove(player)){
|
||||||
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
ItemStack itemStack = ((IWrenchable) tile).getWrenchDrop(player);
|
||||||
if(itemStack == null){
|
if(itemStack == null){
|
||||||
return false;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
items.add(itemStack);
|
items.add(itemStack);
|
||||||
}
|
}
|
||||||
|
@ -99,9 +102,9 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
world.setBlockState(pos, Blocks.air.getDefaultState(), 2);
|
world.setBlockState(pos, Blocks.air.getDefaultState(), 2);
|
||||||
}
|
}
|
||||||
return true;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
return false;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue