Initial commit of BM 1.8
This commit is contained in:
parent
d99eadbea7
commit
c5681dc831
713 changed files with 6502 additions and 27334 deletions
|
@ -157,7 +157,7 @@ public class ArmourForge extends Block
|
|||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.dimensionId, 1, xCoord, yCoord, zCoord);
|
||||
SpellHelper.sendIndexedParticleToAllAround(world, xCoord, yCoord, zCoord, 20, world.provider.getDimensionId(), 1, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
if (itemStack != null)
|
||||
|
|
|
@ -82,7 +82,7 @@ public class BlockHomHeart extends BlockContainer
|
|||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
itemTag.setInteger("dimensionId", world.provider.getDimensionId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class BlockSpellParadigm extends BlockOrientable
|
|||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
itemTag.setInteger("dimensionId", world.provider.getDimensionId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.block.BlockContainer;
|
|||
import net.minecraft.block.BlockMobSpawner;
|
||||
import net.minecraft.block.BlockPortal;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -15,9 +15,14 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import WayofTime.alchemicalWizardry.api.event.TeleposeEvent;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
|
@ -26,9 +31,7 @@ import WayofTime.alchemicalWizardry.common.items.TelepositionFocus;
|
|||
import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer;
|
||||
import codechicken.multipart.MultipartHelper;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
public class BlockTeleposer extends BlockContainer
|
||||
{
|
||||
|
@ -45,35 +48,35 @@ public class BlockTeleposer extends BlockContainer
|
|||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
||||
this.setBlockName("bloodTeleposer");
|
||||
this.setUnlocalizedName("bloodTeleposer");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister)
|
||||
{
|
||||
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
||||
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(IIconRegister iconRegister)
|
||||
// {
|
||||
// this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Top");
|
||||
// this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
// this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:Teleposer_Side");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(int side, int meta)
|
||||
// {
|
||||
// switch (side)
|
||||
// {
|
||||
// case 0:
|
||||
// return bottomIcon;
|
||||
// case 1:
|
||||
// return topIcon;
|
||||
// default:
|
||||
// return sideIcon2;
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case 0:
|
||||
return bottomIcon;
|
||||
case 1:
|
||||
return topIcon;
|
||||
default:
|
||||
return sideIcon2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack playerItem = player.getCurrentEquippedItem();
|
||||
|
||||
|
@ -89,28 +92,28 @@ public class BlockTeleposer extends BlockContainer
|
|||
}
|
||||
|
||||
NBTTagCompound itemTag = playerItem.getTagCompound();
|
||||
itemTag.setInteger("xCoord", x);
|
||||
itemTag.setInteger("yCoord", y);
|
||||
itemTag.setInteger("zCoord", z);
|
||||
itemTag.setInteger("dimensionId", world.provider.dimensionId);
|
||||
itemTag.setInteger("xCoord", pos.getX());
|
||||
itemTag.setInteger("yCoord", pos.getY());
|
||||
itemTag.setInteger("zCoord", pos.getZ());
|
||||
itemTag.setInteger("dimensionId", world.provider.getDimensionId());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z);
|
||||
player.openGui(AlchemicalWizardry.instance, 1, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block par5, int par6)
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
dropItems(world, pos);
|
||||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z)
|
||||
private void dropItems(World world, BlockPos pos)
|
||||
{
|
||||
Random rand = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
|
||||
if (!(tileEntity instanceof IInventory))
|
||||
{
|
||||
|
@ -128,7 +131,7 @@ public class BlockTeleposer extends BlockContainer
|
|||
float rx = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = rand.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + rx, pos.getY() + ry, pos.getZ() + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage()));
|
||||
|
||||
if (item.hasTagCompound())
|
||||
{
|
||||
|
@ -151,20 +154,20 @@ public class BlockTeleposer extends BlockContainer
|
|||
return new TETeleposer();
|
||||
}
|
||||
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, BlockPos posi, BlockPos posf)
|
||||
{
|
||||
return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, true, 3);
|
||||
return swapBlocks(caller, worldI, worldF, posi, posf, true, 3);
|
||||
}
|
||||
|
||||
public static boolean swapBlocksWithoutSound(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf)
|
||||
public static boolean swapBlocksWithoutSound(Object caller, World worldI, World worldF, BlockPos posi, BlockPos posf)
|
||||
{
|
||||
return swapBlocks(caller, worldI, worldF, xi, yi, zi, xf, yf, zf, false, 3);
|
||||
return swapBlocks(caller, worldI, worldF, posi, posf, false, 3);
|
||||
}
|
||||
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, int xi, int yi, int zi, int xf, int yf, int zf, boolean doSound, int flag)
|
||||
public static boolean swapBlocks(Object caller, World worldI, World worldF, BlockPos posi, BlockPos posf, boolean doSound, int flag)
|
||||
{
|
||||
TileEntity tileEntityI = worldI.getTileEntity(xi, yi, zi);
|
||||
TileEntity tileEntityF = worldF.getTileEntity(xf, yf, zf);
|
||||
TileEntity tileEntityI = worldI.getTileEntity(posi);
|
||||
TileEntity tileEntityF = worldF.getTileEntity(posf);
|
||||
|
||||
NBTTagCompound nbttag1 = new NBTTagCompound();
|
||||
NBTTagCompound nbttag2 = new NBTTagCompound();
|
||||
|
@ -179,8 +182,10 @@ public class BlockTeleposer extends BlockContainer
|
|||
tileEntityF.writeToNBT(nbttag2);
|
||||
}
|
||||
|
||||
Block blockI = worldI.getBlock(xi, yi, zi);
|
||||
Block blockF = worldF.getBlock(xf, yf, zf);
|
||||
IBlockState stateI = worldI.getBlockState(posi);
|
||||
Block blockI = stateI.getBlock();
|
||||
IBlockState stateF = worldF.getBlockState(posf);
|
||||
Block blockF = stateF.getBlock();
|
||||
|
||||
|
||||
if (blockI.equals(Blocks.air) && blockF.equals(Blocks.air))
|
||||
|
@ -192,18 +197,15 @@ public class BlockTeleposer extends BlockContainer
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int metaI = worldI.getBlockMetadata(xi, yi, zi);
|
||||
int metaF = worldF.getBlockMetadata(xf, yf, zf);
|
||||
|
||||
TeleposeEvent evt = new TeleposeEvent(worldI, xi, yi, zi, blockI, metaI, worldF, xf, yf, zf, blockF, metaF);
|
||||
TeleposeEvent evt = new TeleposeEvent(worldI, posi, stateI, worldF, posf, stateF);
|
||||
if (MinecraftForge.EVENT_BUS.post(evt))
|
||||
return false;
|
||||
|
||||
if(doSound)
|
||||
{
|
||||
worldI.playSoundEffect(xi, yi, zi, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldF.playSoundEffect(xf, yf, zf, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldI.playSoundEffect(posi.getX(), posi.getY(), posi.getZ(), "mob.endermen.portal", 1.0F, 1.0F);
|
||||
worldF.playSoundEffect(posf.getX(), posf.getY(), posf.getZ(), "mob.endermen.portal", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
//CLEAR TILES
|
||||
|
@ -211,20 +213,20 @@ public class BlockTeleposer extends BlockContainer
|
|||
|
||||
if (finalBlock != null)
|
||||
{
|
||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, metaF);
|
||||
TileEntity tileToSet = finalBlock.createTileEntity(worldF, stateF);
|
||||
|
||||
worldF.setTileEntity(xf, yf, zf, tileToSet);
|
||||
worldF.setTileEntity(posf, tileToSet);
|
||||
}
|
||||
|
||||
if (blockI != null)
|
||||
{
|
||||
TileEntity tileToSet = blockI.createTileEntity(worldI, metaI);
|
||||
TileEntity tileToSet = blockI.createTileEntity(worldI, stateI);
|
||||
|
||||
worldI.setTileEntity(xi, yi, zi, tileToSet);
|
||||
worldI.setTileEntity(posi, tileToSet);
|
||||
}
|
||||
|
||||
//TILES CLEARED
|
||||
worldF.setBlock(xf, yf, zf, blockI, metaI, flag);
|
||||
worldF.setBlockState(posf, stateI, flag);
|
||||
|
||||
if (tileEntityI != null)
|
||||
{
|
||||
|
@ -235,19 +237,16 @@ public class BlockTeleposer extends BlockContainer
|
|||
newTileEntityI = createMultipartFromNBT(worldF, nbttag1);
|
||||
}
|
||||
|
||||
worldF.setTileEntity(xf, yf, zf, newTileEntityI);
|
||||
|
||||
newTileEntityI.xCoord = xf;
|
||||
newTileEntityI.yCoord = yf;
|
||||
newTileEntityI.zCoord = zf;
|
||||
worldF.setTileEntity(posf, newTileEntityI);
|
||||
|
||||
newTileEntityI.setPos(posf);
|
||||
if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityI))
|
||||
{
|
||||
sendDescriptorOfTile(worldF, newTileEntityI);
|
||||
}
|
||||
}
|
||||
|
||||
worldI.setBlock(xi, yi, zi, finalBlock, metaF, flag);
|
||||
worldI.setBlockState(posi, stateF, flag);
|
||||
|
||||
if (tileEntityF != null)
|
||||
{
|
||||
|
@ -257,11 +256,9 @@ public class BlockTeleposer extends BlockContainer
|
|||
newTileEntityF = createMultipartFromNBT(worldI, nbttag2);
|
||||
}
|
||||
|
||||
worldI.setTileEntity(xi, yi, zi, newTileEntityF);
|
||||
worldI.setTileEntity(posi, newTileEntityF);
|
||||
|
||||
newTileEntityF.xCoord = xi;
|
||||
newTileEntityF.yCoord = yi;
|
||||
newTileEntityF.zCoord = zi;
|
||||
newTileEntityF.setPos(posi);
|
||||
|
||||
if(AlchemicalWizardry.isFMPLoaded && isMultipart(tileEntityF))
|
||||
{
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package WayofTime.alchemicalWizardry.common.block;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IOrientable
|
||||
{
|
||||
ForgeDirection getInputDirection();
|
||||
EnumFacing getInputDirection();
|
||||
|
||||
ForgeDirection getOutputDirection();
|
||||
EnumFacing getOutputDirection();
|
||||
|
||||
void setInputDirection(ForgeDirection direction);
|
||||
void setInputDirection(EnumFacing direction);
|
||||
|
||||
void setOutputDirection(ForgeDirection direction);
|
||||
void setOutputDirection(EnumFacing direction);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue