mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-15 17:44:57 +00:00
The great format and clean up. IMPORTANT: Read below.
All devs and contributors should use the provided formatter settings. If your IDE does not support the format, the rules are simple, it is the default java formatting rules, with 200char line lengths and 1 extra line after class definitions.
This commit is contained in:
1 parent
906c730a3c
commit
4cfcc874dc
136 files changed
+10365
-11272
No files matched your search
@@ -1,15 +1,12 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -17,87 +14,83 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import com.cricketcraft.chisel.init.ModBlocks;
|
||||
import com.cricketcraft.chisel.init.ModItems;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
public class BlockAutoChisel extends BlockContainer {
|
||||
|
||||
public class BlockAutoChisel extends BlockContainer{
|
||||
public BlockAutoChisel() {
|
||||
super(Material.rock);
|
||||
setHardness(1F);
|
||||
}
|
||||
public BlockAutoChisel() {
|
||||
super(Material.rock);
|
||||
setHardness(1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float x1, float y1, float z1) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (world.isRemote)
|
||||
return true;
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float x1, float y1, float z1) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (world.isRemote)
|
||||
return true;
|
||||
|
||||
if (tile != null && tile instanceof TileEntityAutoChisel && !player.isSneaking()){
|
||||
player.openGui(Chisel.instance, 1, world, x, y, z);
|
||||
}
|
||||
if (tile != null && tile instanceof TileEntityAutoChisel && !player.isSneaking()) {
|
||||
player.openGui(Chisel.instance, 1, world, x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z) {
|
||||
Random random = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
private void dropItems(World world, int x, int y, int z) {
|
||||
Random random = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if (!(tileEntity instanceof TileEntityAutoChisel)) {
|
||||
return;
|
||||
}
|
||||
if (!(tileEntity instanceof TileEntityAutoChisel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntityAutoChisel inventory = (TileEntityAutoChisel) world.getTileEntity(x, y, z);
|
||||
TileEntityAutoChisel inventory = (TileEntityAutoChisel) world.getTileEntity(x, y, z);
|
||||
|
||||
for (int c = 0; c < inventory.getSizeInventory(); c++) {
|
||||
ItemStack stack = inventory.getStackInSlot(c);
|
||||
for (int c = 0; c < inventory.getSizeInventory(); c++) {
|
||||
ItemStack stack = inventory.getStackInSlot(c);
|
||||
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
float rx = random.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = random.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, stack);
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
float rx = random.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = random.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, stack);
|
||||
|
||||
if (stack.hasTagCompound()) {
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
|
||||
}
|
||||
if (stack.hasTagCompound()) {
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = random.nextGaussian() * factor;
|
||||
entityItem.motionY = random.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = random.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = random.nextGaussian() * factor;
|
||||
entityItem.motionY = random.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = random.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new TileEntityAutoChisel();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new TileEntityAutoChisel();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user