mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-18 11:29:05 +00:00
Spotless
This commit is contained in:
156 files changed
+14896
-13422
No files matched your search
@@ -18,96 +18,84 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockEffectJar extends BlockContainer
|
||||
{
|
||||
public BlockEffectJar()
|
||||
{
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("effectJar");
|
||||
this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f);
|
||||
this.setHardness(0.1f);
|
||||
this.setResistance(1.5f);
|
||||
}
|
||||
public class BlockEffectJar extends BlockContainer {
|
||||
public BlockEffectJar() {
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("effectJar");
|
||||
this.setBlockBounds(0.25f, 0f, 0.25f, 0.75f, 0.81f, 0.74f);
|
||||
this.setHardness(0.1f);
|
||||
this.setResistance(1.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
boolean activate = false;
|
||||
|
||||
if (!player.isSneaking())
|
||||
{
|
||||
player.openGui(MagicBees.object, UIScreens.EFFECT_JAR.ordinal(), world, x, y, z);
|
||||
activate = true;
|
||||
}
|
||||
|
||||
return activate;
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
boolean activate = false;
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World w, int metadata)
|
||||
{
|
||||
return new TileEntityEffectJar();
|
||||
}
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(MagicBees.object, UIScreens.EFFECT_JAR.ordinal(), world, x, y, z);
|
||||
activate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return activate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World w, int metadata) {
|
||||
return new TileEntityEffectJar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return CommonProxy.RenderIdEffectJar;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
||||
{
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void dropInventory(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity e = world.getTileEntity(x, y, z);
|
||||
|
||||
if (e != null && e instanceof TileEntityEffectJar)
|
||||
{
|
||||
TileEntityEffectJar jar = (TileEntityEffectJar)e;
|
||||
|
||||
// 0 is the only droppable stack.
|
||||
ItemStack stack = jar.getStackInSlot(0);
|
||||
|
||||
if (stack != null && stack.stackSize > 0)
|
||||
{
|
||||
float pX = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pY = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pZ = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy());
|
||||
|
||||
entityItem.motionX = world.rand.nextGaussian() * 0.05f;
|
||||
entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f;
|
||||
entityItem.motionZ = world.rand.nextGaussian() * 0.05f;
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return CommonProxy.RenderIdEffectJar;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = Blocks.glass.getIcon(0, 0);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
private void dropInventory(World world, int x, int y, int z) {
|
||||
TileEntity e = world.getTileEntity(x, y, z);
|
||||
|
||||
if (e != null && e instanceof TileEntityEffectJar) {
|
||||
TileEntityEffectJar jar = (TileEntityEffectJar) e;
|
||||
|
||||
// 0 is the only droppable stack.
|
||||
ItemStack stack = jar.getStackInSlot(0);
|
||||
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
float pX = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pY = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
float pZ = world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, x + pX, y + pY, z + pZ, stack.copy());
|
||||
|
||||
entityItem.motionX = world.rand.nextGaussian() * 0.05f;
|
||||
entityItem.motionY = world.rand.nextGaussian() * 0.05f + 0.2f;
|
||||
entityItem.motionZ = world.rand.nextGaussian() * 0.05f;
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
this.blockIcon = Blocks.glass.getIcon(0, 0);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user