734
This commit is contained in:
parent
ef82ceb714
commit
839647ed85
9 changed files with 86 additions and 99 deletions
|
@ -2,10 +2,13 @@ package techreborn.blocks;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
@ -42,7 +45,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||||
return Item.getItemFromBlock(this);
|
return Item.getItemFromBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,8 +58,8 @@ public class BlockMachineCasing extends BlockMultiblockBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int metaData) {
|
public int damageDropped(IBlockState state) {
|
||||||
return metaData;
|
return super.damageDropped(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,11 +67,10 @@ public class BlockMachineCasing extends BlockMultiblockBase {
|
||||||
return new TileMachineCasing();
|
return new TileMachineCasing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) {
|
||||||
Block b = par1IBlockAccess.getBlock(par2, par3, par4);
|
Block b = worldIn.getBlockState(pos).getBlock();
|
||||||
return b == (Block) this ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
|
return b == (Block) this ? false : super.shouldSideBeRendered(worldIn, pos, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta) {
|
public boolean shouldConnectToBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int meta) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package techreborn.blocks;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -43,9 +44,9 @@ public class BlockMachineFrame extends Block {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(int metaData) {
|
|
||||||
return metaData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int damageDropped(IBlockState state) {
|
||||||
|
return super.damageDropped(state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,15 @@ package techreborn.blocks;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
@ -21,6 +24,7 @@ import techreborn.items.ItemGems;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BlockOre extends Block {
|
public class BlockOre extends Block {
|
||||||
|
|
||||||
|
@ -52,14 +56,18 @@ public class BlockOre extends Block {
|
||||||
setHardness(2.0f);
|
setHardness(2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
|
||||||
|
@Deprecated
|
||||||
|
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
|
int metadata = 0; //TODO meta fix
|
||||||
|
Random random = new Random();
|
||||||
//Ruby
|
//Ruby
|
||||||
if (metadata == 2) {
|
if (metadata == 2) {
|
||||||
OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||||
OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("redGarnet"), 0.02);
|
OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("redGarnet"), 0.02);
|
||||||
OreDropSet set = new OreDropSet(ruby, redGarnet);
|
OreDropSet set = new OreDropSet(ruby, redGarnet);
|
||||||
return set.drop(fortune, world.rand);
|
return set.drop(fortune, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sapphire
|
//Sapphire
|
||||||
|
@ -67,14 +75,14 @@ public class BlockOre extends Block {
|
||||||
OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||||
OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), 0.03);
|
OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), 0.03);
|
||||||
OreDropSet set = new OreDropSet(sapphire, peridot);
|
OreDropSet set = new OreDropSet(sapphire, peridot);
|
||||||
return set.drop(fortune, world.rand);
|
return set.drop(fortune, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Pyrite
|
//Pyrite
|
||||||
if (metadata == 5) {
|
if (metadata == 5) {
|
||||||
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||||
OreDropSet set = new OreDropSet(pyriteDust);
|
OreDropSet set = new OreDropSet(pyriteDust);
|
||||||
return set.drop(fortune, world.rand);
|
return set.drop(fortune, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sodolite
|
//Sodolite
|
||||||
|
@ -82,7 +90,7 @@ public class BlockOre extends Block {
|
||||||
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
OreDrop sodalite = new OreDrop(ItemDusts.getDustByName("sodalite", 6), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||||
OreDrop aluminum = new OreDrop(ItemDusts.getDustByName("aluminum"), 0.50);
|
OreDrop aluminum = new OreDrop(ItemDusts.getDustByName("aluminum"), 0.50);
|
||||||
OreDropSet set = new OreDropSet(sodalite, aluminum);
|
OreDropSet set = new OreDropSet(sodalite, aluminum);
|
||||||
return set.drop(fortune, world.rand);
|
return set.drop(fortune, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Cinnabar
|
//Cinnabar
|
||||||
|
@ -90,7 +98,7 @@ public class BlockOre extends Block {
|
||||||
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
OreDrop cinnabar = new OreDrop(ItemDusts.getDustByName("cinnabar"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||||
OreDrop redstone = new OreDrop(new ItemStack(Items.redstone), 0.25);
|
OreDrop redstone = new OreDrop(new ItemStack(Items.redstone), 0.25);
|
||||||
OreDropSet set = new OreDropSet(cinnabar, redstone);
|
OreDropSet set = new OreDropSet(cinnabar, redstone);
|
||||||
return set.drop(fortune, world.rand);
|
return set.drop(fortune, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sphalerite 1, 1/8 yellow garnet
|
//Sphalerite 1, 1/8 yellow garnet
|
||||||
|
@ -98,7 +106,7 @@ public class BlockOre extends Block {
|
||||||
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
OreDrop sphalerite = new OreDrop(ItemDusts.getDustByName("sphalerite"), ConfigTechReborn.FortuneSecondaryOreMultiplierPerLevel);
|
||||||
OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), 0.125);
|
OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), 0.125);
|
||||||
OreDropSet set = new OreDropSet(sphalerite, yellowGarnet);
|
OreDropSet set = new OreDropSet(sphalerite, yellowGarnet);
|
||||||
return set.drop(fortune, world.rand);
|
return set.drop(fortune, random);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<ItemStack> block = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> block = new ArrayList<ItemStack>();
|
||||||
|
@ -119,21 +127,22 @@ public class BlockOre extends Block {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(int metaData) {
|
// @Override
|
||||||
if (metaData == 2) {
|
// public int damageDropped(int metaData) {
|
||||||
return 0;
|
// if (metaData == 2) {
|
||||||
} else if (metaData == 3) {
|
// return 0;
|
||||||
return 1;
|
// } else if (metaData == 3) {
|
||||||
} else if (metaData == 5) {
|
// return 1;
|
||||||
return 60;
|
// } else if (metaData == 5) {
|
||||||
}
|
// return 60;
|
||||||
return metaData;
|
// }
|
||||||
}
|
// return metaData;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
return new ItemStack(ModBlocks.ore, 1, world.getBlockMetadata(x, y, z));
|
return super.getPickBlock(target, world, pos, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,17 @@ package techreborn.blocks;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
@ -34,7 +37,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int par1, Random random, int par2) {
|
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||||
return Item.getItemFromBlock(this);
|
return Item.getItemFromBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,10 +49,6 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(int metaData) {
|
|
||||||
return metaData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,7 +62,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
|
public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +72,8 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int isProvidingStrongPower(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
public int isProvidingWeakPower(IBlockAccess blockAccess, BlockPos pos, IBlockState state, EnumFacing side) {
|
||||||
TileEntity entity = blockAccess.getTileEntity(x, y, z);
|
TileEntity entity = blockAccess.getTileEntity(pos);
|
||||||
if (entity instanceof TilePlayerDectector) {
|
if (entity instanceof TilePlayerDectector) {
|
||||||
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
|
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
|
||||||
}
|
}
|
||||||
|
@ -82,8 +81,8 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int isProvidingWeakPower(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
public int isProvidingStrongPower(IBlockAccess blockAccess, BlockPos pos, IBlockState state, EnumFacing side) {
|
||||||
TileEntity entity = blockAccess.getTileEntity(x, y, z);
|
TileEntity entity = blockAccess.getTileEntity(pos);
|
||||||
if (entity instanceof TilePlayerDectector) {
|
if (entity instanceof TilePlayerDectector) {
|
||||||
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
|
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +92,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||||
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||||
if (tile instanceof TilePlayerDectector) {
|
if (tile instanceof TilePlayerDectector) {
|
||||||
((TilePlayerDectector) tile).owenerUdid = player.getUniqueID().toString();
|
((TilePlayerDectector) tile).owenerUdid = player.getUniqueID().toString();
|
||||||
}
|
}
|
||||||
|
@ -104,7 +103,8 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
||||||
if (super.onBlockActivated(world, x, y, z, entityplayer, side, hitX, hitY, hitZ)) {
|
if (super.onBlockActivated(world, x, y, z, entityplayer, side, hitX, hitY, hitZ)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int newMeta = (world.getBlockMetadata(x, y, z) + 1) % 3;
|
// int newMeta = (world.getBlockMetadata(x, y, z) + 1) % 3;
|
||||||
|
int newMeta = 0; //TODO meta fix
|
||||||
String message = "";
|
String message = "";
|
||||||
switch (newMeta) {
|
switch (newMeta) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -118,7 +118,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
|
||||||
}
|
}
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
entityplayer.addChatComponentMessage(new ChatComponentText(message));
|
entityplayer.addChatComponentMessage(new ChatComponentText(message));
|
||||||
world.setBlockMetadataWithNotify(x, y, z, newMeta, 2);
|
//world.setBlockMetadataWithNotify(x, y, z, newMeta, 2);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package techreborn.blocks.storage;
|
package techreborn.blocks.storage;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
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.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
@ -18,42 +17,12 @@ import techreborn.tiles.idsu.TileIDSU;
|
||||||
|
|
||||||
public class BlockIDSU extends BlockMachineBase {
|
public class BlockIDSU extends BlockMachineBase {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
private IIcon iconFront;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
private IIcon iconTop;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
private IIcon iconBottom;
|
|
||||||
|
|
||||||
public BlockIDSU(Material material) {
|
public BlockIDSU(Material material) {
|
||||||
super(material);
|
super(material);
|
||||||
setUnlocalizedName("techreborn.idsu");
|
setUnlocalizedName("techreborn.idsu");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(IIconRegister icon) {
|
|
||||||
this.blockIcon = icon.registerIcon("techreborn:machine/idsu_side");
|
|
||||||
this.iconFront = icon.registerIcon("techreborn:machine/idsu_front");
|
|
||||||
this.iconTop = icon.registerIcon("techreborn:machine/idsu_side");
|
|
||||||
this.iconBottom = icon.registerIcon("techreborn:machine/idsu_side");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
|
||||||
int metadata = getTileRotation(blockAccess, x, y, z);
|
|
||||||
if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
|
|
||||||
return this.iconFront;
|
|
||||||
}
|
|
||||||
return metadata == 0 && side == 3 ? this.iconFront
|
|
||||||
: side == 1 ? this.iconTop :
|
|
||||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
|
||||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||||
return new TileIDSU(5, 2048, 100000000);
|
return new TileIDSU(5, 2048, 100000000);
|
||||||
|
@ -72,7 +41,7 @@ public class BlockIDSU extends BlockMachineBase {
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||||
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
|
||||||
if (tile instanceof TileIDSU) {
|
if (tile instanceof TileIDSU) {
|
||||||
((TileIDSU) tile).ownerUdid = player.getUniqueID().toString();
|
((TileIDSU) tile).ownerUdid = player.getUniqueID().toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import techreborn.blocks.BlockMachineBase;
|
import techreborn.blocks.BlockMachineBase;
|
||||||
|
@ -21,15 +22,15 @@ public class BlockLesuStorage extends BlockMachineBase {
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) {
|
||||||
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
super.onBlockPlacedBy(world, x, y, z, player, itemstack);
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileLesuStorage) {
|
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage) {
|
||||||
((TileLesuStorage) world.getTileEntity(x, y, z)).rebuildNetwork();
|
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).rebuildNetwork();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileLesuStorage) {
|
if (world.getTileEntity(new BlockPos(x, y, z)) instanceof TileLesuStorage) {
|
||||||
((TileLesuStorage) world.getTileEntity(x, y, z)).removeFromNetwork();
|
((TileLesuStorage) world.getTileEntity(new BlockPos(x, y, z))).removeFromNetwork();
|
||||||
}
|
}
|
||||||
super.breakBlock(world, x, y, z, block, meta);
|
super.breakBlock(world, x, y, z, block, meta);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class TileAesu extends TilePowerAcceptor implements IWrenchable {
|
||||||
|
|
||||||
public static final int MAX_OUTPUT = ConfigTechReborn.aesuMaxOutput;
|
public static final int MAX_OUTPUT = ConfigTechReborn.aesuMaxOutput;
|
||||||
public static final int MAX_STORAGE = ConfigTechReborn.aesuMaxStorage;
|
public static final int MAX_STORAGE = ConfigTechReborn.aesuMaxStorage;
|
||||||
public Inventory inventory = new Inventory(2, "TileAesu", 64);
|
public Inventory inventory = new Inventory(2, "TileAesu", 64, this);
|
||||||
private int OUTPUT = 64; //The current output
|
private int OUTPUT = 64; //The current output
|
||||||
private double euLastTick = 0;
|
private double euLastTick = 0;
|
||||||
private double euChange;
|
private double euChange;
|
||||||
|
@ -116,7 +116,7 @@ public class TileAesu extends TilePowerAcceptor implements IWrenchable {
|
||||||
ItemStack dropStack = new ItemStack(ModBlocks.Aesu, 1);
|
ItemStack dropStack = new ItemStack(ModBlocks.Aesu, 1);
|
||||||
writeToNBTWithoutCoords(tileEntity);
|
writeToNBTWithoutCoords(tileEntity);
|
||||||
dropStack.setTagCompound(new NBTTagCompound());
|
dropStack.setTagCompound(new NBTTagCompound());
|
||||||
dropStack.stackTagCompound.setTag("tileEntity", tileEntity);
|
dropStack.getTagCompound().setTag("tileEntity", tileEntity);
|
||||||
return dropStack;
|
return dropStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,24 +53,25 @@ public class TilePlayerDectector extends TilePowerAcceptor {
|
||||||
while (tIterator.hasNext()) {
|
while (tIterator.hasNext()) {
|
||||||
EntityPlayer player = (EntityPlayer) tIterator.next();
|
EntityPlayer player = (EntityPlayer) tIterator.next();
|
||||||
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D, (double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D, (double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
||||||
if(worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == 0){//ALL
|
// if(worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == 0){//ALL
|
||||||
redstone = true;
|
// redstone = true;
|
||||||
} else if (blockMetadata == 1){//Others
|
// } else if (blockMetadata == 1){//Others
|
||||||
if(!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())){
|
// if(!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())){
|
||||||
redstone = true;
|
// redstone = true;
|
||||||
}
|
// }
|
||||||
} else {//You
|
// } else {//You
|
||||||
if(!owenerUdid.isEmpty() &&owenerUdid.equals(player.getUniqueID().toString())){
|
// if(!owenerUdid.isEmpty() &&owenerUdid.equals(player.getUniqueID().toString())){
|
||||||
redstone = true;
|
// redstone = true;
|
||||||
}
|
// }
|
||||||
}
|
// }//TODO meta fix
|
||||||
|
redstone = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
useEnergy(50);
|
useEnergy(50);
|
||||||
}
|
}
|
||||||
if(lastRedstone != redstone){
|
if(lastRedstone != redstone){
|
||||||
worldObj.markBlockForUpdate(getPos().getX(), getPos().getY(), getPos().getZ());
|
worldObj.markBlockForUpdate(getPos());
|
||||||
worldObj.notifyBlocksOfNeighborChange(getPos().getX(), getPos().getY(), getPos().getZ(), worldObj.getBlock(getPos().getX(), getPos().getY(), getPos().getZ()));
|
worldObj.notifyNeighborsOfStateChange(getPos(), worldObj.getBlockState(getPos()).getBlock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,18 @@ public class TileIDSU extends TilePowerAcceptor {
|
||||||
return 1000000000;
|
return 1000000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//TODO meta fix
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||||
return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) != Functions.getIntDirFromDirection(direction);
|
//return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) != Functions.getIntDirFromDirection(direction);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(EnumFacing direction) {
|
public boolean canProvideEnergy(EnumFacing direction) {
|
||||||
return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == Functions.getIntDirFromDirection(direction);
|
//return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == Functions.getIntDirFromDirection(direction);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue