mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-13 16:54:06 +00:00
Fix up indentation in the ItemTerraformRod class.
This commit is contained in:
1 parent
4705b4b16f
commit
e22d8dd6ac
1 file changed
+110
-111
@@ -12,6 +12,7 @@
|
||||
package vazkii.botania.common.item.rod;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -36,144 +37,142 @@ public class ItemTerraformRod extends ItemMod implements IManaUsingItem {
|
||||
|
||||
private static final int COST_PER = 55;
|
||||
|
||||
static final List<String> validBlocks = new ArrayList() {
|
||||
{
|
||||
add("stone");
|
||||
add("dirt");
|
||||
add("grass");
|
||||
add("sand");
|
||||
add("gravel");
|
||||
add("hardenedClay");
|
||||
add("snowLayer");
|
||||
add("mycelium");
|
||||
add("podzol");
|
||||
add("sandstone");
|
||||
}};
|
||||
static final List<String> validBlocks = Arrays.asList(new String[] {
|
||||
"stone",
|
||||
"dirt",
|
||||
"grass",
|
||||
"sand",
|
||||
"gravel",
|
||||
"hardenedClay",
|
||||
"snowLayer",
|
||||
"mycelium",
|
||||
"podzol",
|
||||
"sandstone"
|
||||
});
|
||||
|
||||
public ItemTerraformRod() {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(LibItemNames.TERRAFORM_ROD);
|
||||
}
|
||||
public ItemTerraformRod() {
|
||||
super();
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(LibItemNames.TERRAFORM_ROD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 72000;
|
||||
}
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
|
||||
if(count != getMaxItemUseDuration(stack) && count % 10 == 0)
|
||||
terraform(stack, player.worldObj, player);
|
||||
}
|
||||
@Override
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
|
||||
if(count != getMaxItemUseDuration(stack) && count % 10 == 0)
|
||||
terraform(stack, player.worldObj, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
|
||||
return par1ItemStack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
public void terraform(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
int range = 16;
|
||||
public void terraform(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
int range = 16;
|
||||
|
||||
int xCenter = (int) par3EntityPlayer.posX;
|
||||
int yCenter = (int) par3EntityPlayer.posY - (par2World.isRemote ? 2 : 1);
|
||||
int zCenter = (int) par3EntityPlayer.posZ;
|
||||
int xCenter = (int) par3EntityPlayer.posX;
|
||||
int yCenter = (int) par3EntityPlayer.posY - (par2World.isRemote ? 2 : 1);
|
||||
int zCenter = (int) par3EntityPlayer.posZ;
|
||||
|
||||
if(yCenter < 62) // Not below sea level
|
||||
return;
|
||||
if(yCenter < 62) // Not below sea level
|
||||
return;
|
||||
|
||||
int yStart = yCenter + range;
|
||||
int yStart = yCenter + range;
|
||||
|
||||
List<CoordsWithBlock> blocks = new ArrayList();
|
||||
List<CoordsWithBlock> blocks = new ArrayList();
|
||||
|
||||
for(int i = -range; i < range + 1; i++)
|
||||
for(int j = -range; j < range + 1; j++) {
|
||||
int k = 0;
|
||||
while(true) {
|
||||
if(yStart + k < 0)
|
||||
break;
|
||||
for(int i = -range; i < range + 1; i++)
|
||||
for(int j = -range; j < range + 1; j++) {
|
||||
int k = 0;
|
||||
while(true) {
|
||||
if(yStart + k < 0)
|
||||
break;
|
||||
|
||||
int x = xCenter + i;
|
||||
int y = yStart + k;
|
||||
int z = zCenter + j;
|
||||
int x = xCenter + i;
|
||||
int y = yStart + k;
|
||||
int z = zCenter + j;
|
||||
|
||||
Block block = par2World.getBlock(x, y, z);
|
||||
int meta = par2World.getBlockMetadata(x, y, z);
|
||||
Block block = par2World.getBlock(x, y, z);
|
||||
int meta = par2World.getBlockMetadata(x, y, z);
|
||||
|
||||
int[] ids = OreDictionary.getOreIDs(new ItemStack(block, 1, meta));
|
||||
for(int id : ids)
|
||||
if(validBlocks.contains(OreDictionary.getOreName(id))) {
|
||||
int[] ids = OreDictionary.getOreIDs(new ItemStack(block, 1, meta));
|
||||
for(int id : ids)
|
||||
if(validBlocks.contains(OreDictionary.getOreName(id))) {
|
||||
boolean hasAir = false;
|
||||
List<ChunkCoordinates> airBlocks = new ArrayList();
|
||||
|
||||
boolean hasAir = false;
|
||||
List<ChunkCoordinates> airBlocks = new ArrayList();
|
||||
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
int x_ = x + dir.offsetX;
|
||||
int y_ = y + dir.offsetY;
|
||||
int z_ = z + dir.offsetZ;
|
||||
|
||||
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
int x_ = x + dir.offsetX;
|
||||
int y_ = y + dir.offsetY;
|
||||
int z_ = z + dir.offsetZ;
|
||||
|
||||
Block block_ = par2World.getBlock(x_, y_, z_);
|
||||
if(block_.isAir(par2World, x_, y_, z_) || block_.isReplaceable(par2World, x_, y_, z_) || block_ instanceof BlockFlower && !(block_ instanceof ISpecialFlower) || block_ == Blocks.double_plant) {
|
||||
airBlocks.add(new ChunkCoordinates(x_, y_, z_));
|
||||
hasAir = true;
|
||||
}
|
||||
Block block_ = par2World.getBlock(x_, y_, z_);
|
||||
if(block_.isAir(par2World, x_, y_, z_) || block_.isReplaceable(par2World, x_, y_, z_) || block_ instanceof BlockFlower && !(block_ instanceof ISpecialFlower) || block_ == Blocks.double_plant) {
|
||||
airBlocks.add(new ChunkCoordinates(x_, y_, z_));
|
||||
hasAir = true;
|
||||
}
|
||||
|
||||
if(hasAir) {
|
||||
if(y > yCenter)
|
||||
blocks.add(new CoordsWithBlock(x, y, z, Blocks.air));
|
||||
else for(ChunkCoordinates coords : airBlocks) {
|
||||
if(par2World.getBlock(coords.posX, coords.posY - 1, coords.posZ) != Blocks.air)
|
||||
blocks.add(new CoordsWithBlock(coords.posX, coords.posY, coords.posZ, Blocks.dirt));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
--k;
|
||||
}
|
||||
}
|
||||
|
||||
int cost = COST_PER * blocks.size();
|
||||
|
||||
if(par2World.isRemote || ManaItemHandler.requestManaExact(par1ItemStack, par3EntityPlayer, cost, true)) {
|
||||
if(!par2World.isRemote)
|
||||
for(CoordsWithBlock block : blocks)
|
||||
par2World.setBlock(block.posX, block.posY, block.posZ, block.block);
|
||||
|
||||
if(!blocks.isEmpty()) {
|
||||
for(int i = 0; i < 10; i++)
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "step.sand", 1F, 0.4F);
|
||||
for(int i = 0; i < 120; i++)
|
||||
Botania.proxy.sparkleFX(par2World, xCenter - range + range * 2 * Math.random(), yCenter + 2 + (Math.random() - 0.5) * 2, zCenter - range + range * 2 * Math.random(), 0.35F, 0.2F, 0.05F, 2F, 5);
|
||||
if(hasAir) {
|
||||
if(y > yCenter)
|
||||
blocks.add(new CoordsWithBlock(x, y, z, Blocks.air));
|
||||
else for(ChunkCoordinates coords : airBlocks) {
|
||||
if(par2World.getBlock(coords.posX, coords.posY - 1, coords.posZ) != Blocks.air)
|
||||
blocks.add(new CoordsWithBlock(coords.posX, coords.posY, coords.posZ, Blocks.dirt));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
--k;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
int cost = COST_PER * blocks.size();
|
||||
|
||||
class CoordsWithBlock extends ChunkCoordinates {
|
||||
if(par2World.isRemote || ManaItemHandler.requestManaExact(par1ItemStack, par3EntityPlayer, cost, true)) {
|
||||
if(!par2World.isRemote)
|
||||
for(CoordsWithBlock block : blocks)
|
||||
par2World.setBlock(block.posX, block.posY, block.posZ, block.block);
|
||||
|
||||
final Block block;
|
||||
|
||||
public CoordsWithBlock(int x, int y, int z, Block block) {
|
||||
super(x, y, z);
|
||||
this.block = block;
|
||||
if(!blocks.isEmpty()) {
|
||||
for(int i = 0; i < 10; i++)
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "step.sand", 1F, 0.4F);
|
||||
for(int i = 0; i < 120; i++)
|
||||
Botania.proxy.sparkleFX(par2World, xCenter - range + range * 2 * Math.random(), yCenter + 2 + (Math.random() - 0.5) * 2, zCenter - range + range * 2 * Math.random(), 0.35F, 0.2F, 0.05F, 2F, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
class CoordsWithBlock extends ChunkCoordinates {
|
||||
|
||||
final Block block;
|
||||
|
||||
public CoordsWithBlock(int x, int y, int z, Block block) {
|
||||
super(x, y, z);
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMana(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMana(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user