mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Most functional flora
This commit is contained in:
1 parent
b4d9c3ded8
commit
c0bcfb6448
25 files changed
+184
-205
No files matched your search
@@ -11,6 +11,7 @@
|
||||
package vazkii.botania.api.item;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
/**
|
||||
@@ -21,7 +22,7 @@ public interface IFlowerPlaceable {
|
||||
/**
|
||||
* Gets the block to be placed, return null to not place anything.
|
||||
*/
|
||||
public Block getBlockToPlaceByFlower(ItemStack stack, SubTileEntity flower, int x, int y, int z);
|
||||
public Block getBlockToPlaceByFlower(ItemStack stack, SubTileEntity flower, BlockPos pos);
|
||||
|
||||
public void onBlockPlacedByFlower(ItemStack stack, SubTileEntity flower, int x, int y, int z);
|
||||
public void onBlockPlacedByFlower(ItemStack stack, SubTileEntity flower, BlockPos pos);
|
||||
}
|
||||
+14
-13
@@ -17,6 +17,7 @@ import net.minecraft.block.BlockSapling;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
@@ -34,22 +35,22 @@ public class SubTileAgricarnation extends SubTileFunctional {
|
||||
|
||||
if(ticksExisted % 6 == 0 && redstoneSignal == 0) {
|
||||
int range = getRange();
|
||||
int x = supertile.xCoord + supertile.getWorld().rand.nextInt(range * 2 + 1) - range;
|
||||
int z = supertile.zCoord + supertile.getWorld().rand.nextInt(range * 2 + 1) - range;
|
||||
int x = supertile.getPos().getX() + supertile.getWorld().rand.nextInt(range * 2 + 1) - range;
|
||||
int z = supertile.getPos().getZ() + supertile.getWorld().rand.nextInt(range * 2 + 1) - range;
|
||||
|
||||
for(int i = 4; i > -2; i--) {
|
||||
int y = supertile.yCoord + i;
|
||||
|
||||
if(supertile.getWorld().isAirBlock(x, y, z))
|
||||
int y = supertile.getPos().getY() + i;
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
if(supertile.getWorld().isAirBlock(pos))
|
||||
continue;
|
||||
|
||||
if(isPlant(x, y, z) && mana > 5) {
|
||||
Block block = supertile.getWorld().getBlock(x, y, z);
|
||||
if(isPlant(pos) && mana > 5) {
|
||||
Block block = supertile.getWorld().getBlockState(pos).getBlock();
|
||||
mana -= 5;
|
||||
supertile.getWorld().scheduleBlockUpdate(x, y, z, block, 1);
|
||||
supertile.getWorld().scheduleUpdate(pos, block, 1);
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorldObj().playAuxSFX(2005, x, y, z, 6 + supertile.getWorldObj().rand.nextInt(4));
|
||||
supertile.getWorldObj().playSoundEffect(x, y, z, "botania:agricarnation", 0.01F, 0.5F + (float) Math.random() * 0.5F);
|
||||
supertile.getWorld().playAuxSFX(2005, pos, 6 + supertile.getWorld().rand.nextInt(4));
|
||||
supertile.getWorld().playSoundEffect(x, y, z, "botania:agricarnation", 0.01F, 0.5F + (float) Math.random() * 0.5F);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -62,13 +63,13 @@ public class SubTileAgricarnation extends SubTileFunctional {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean isPlant(int x, int y, int z) {
|
||||
Block block = supertile.getWorld().getBlock(x, y, z);
|
||||
boolean isPlant(BlockPos pos) {
|
||||
Block block = supertile.getWorld().getBlockState(pos).getBlock();
|
||||
if(block == Blocks.grass || block == Blocks.leaves || block == Blocks.leaves2 || block instanceof BlockBush && !(block instanceof BlockCrops) && !(block instanceof BlockSapling))
|
||||
return false;
|
||||
|
||||
Material mat = block.getMaterial();
|
||||
return mat != null && (mat == Material.plants || mat == Material.cactus || mat == Material.grass || mat == Material.leaves || mat == Material.gourd) && block instanceof IGrowable && ((IGrowable) block).func_149851_a(supertile.getWorld(), x, y, z, supertile.getWorld().isRemote);
|
||||
return mat != null && (mat == Material.plants || mat == Material.cactus || mat == Material.grass || mat == Material.leaves || mat == Material.gourd) && block instanceof IGrowable && ((IGrowable) block).canGrow(supertile.getWorld(), pos, supertile.getWorld().getBlockState(pos), supertile.getWorld().isRemote);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -50,11 +51,11 @@ public class SubTileBellethorn extends SubTileFunctional {
|
||||
|
||||
if(ticksExisted % 5 == 0) {
|
||||
int range = getRange();
|
||||
List<EntityLivingBase> entities = supertile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(supertile.xCoord - range, supertile.yCoord, supertile.zCoord - range, supertile.xCoord + range + 1, supertile.yCoord + 1, supertile.zCoord + range + 1));
|
||||
IEntitySelector selector = getSelector();
|
||||
List<EntityLivingBase> entities = supertile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(supertile.getPos().add(-range, -range, -range), supertile.getPos().add(range + 1, range + 1, range + 1)));
|
||||
Predicate<Entity> selector = getSelector();
|
||||
|
||||
for(EntityLivingBase entity : entities) {
|
||||
if(!selector.isEntityApplicable(entity))
|
||||
if(!selector.apply(entity))
|
||||
continue;
|
||||
|
||||
if(entity.hurtTime == 0 && mana >= manaToUse) {
|
||||
@@ -83,11 +84,11 @@ public class SubTileBellethorn extends SubTileFunctional {
|
||||
return RANGE;
|
||||
}
|
||||
|
||||
public IEntitySelector getSelector() {
|
||||
return new IEntitySelector() {
|
||||
public Predicate<Entity> getSelector() {
|
||||
return new Predicate<Entity>() {
|
||||
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity entity) {
|
||||
public boolean apply(Entity entity) {
|
||||
return !(entity instanceof EntityPlayer);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.ISubTileContainer;
|
||||
@@ -47,18 +48,18 @@ public class SubTileBubbell extends SubTileFunctional {
|
||||
for(int j = -range; j < range + 1; j++)
|
||||
for(int k = -range; k < range + 1; k++)
|
||||
if(MathHelper.pointDistanceSpace(i, j, k, 0, 0, 0) < range) {
|
||||
Block block = supertile.getWorld().getBlock(supertile.xCoord + i, supertile.yCoord + j, supertile.zCoord + k);
|
||||
Block block = supertile.getWorld().getBlockState(supertile.getPos().add(i, j, k)).getBlock();
|
||||
if(block.getMaterial() == Material.water) {
|
||||
supertile.getWorld().setBlock(supertile.xCoord + i, supertile.yCoord + j, supertile.zCoord + k, ModBlocks.fakeAir, 0, 2);
|
||||
TileFakeAir air = (TileFakeAir) supertile.getWorld().getTileEntity(supertile.xCoord + i, supertile.yCoord + j, supertile.zCoord + k);
|
||||
supertile.getWorld().setBlockState(supertile.getPos().add(i, j, k), ModBlocks.fakeAir.getDefaultState(), 2);
|
||||
TileFakeAir air = (TileFakeAir) supertile.getWorld().getTileEntity(supertile.getPos().add(i, j, k));
|
||||
air.setFlower(supertile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isValidBubbell(World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
public static boolean isValidBubbell(World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null && tile instanceof ISubTileContainer) {
|
||||
ISubTileContainer container = (ISubTileContainer) tile;
|
||||
if(container.getSubTile() != null && container.getSubTile() instanceof SubTileBubbell) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
@@ -38,10 +39,10 @@ public class SubTileClayconia extends SubTileFunctional {
|
||||
if(mana >= manaCost) {
|
||||
BlockPos coords = getCoordsToPut();
|
||||
if(coords != null) {
|
||||
supertile.getWorld().setBlockToAir(coords.posX, coords.posY, coords.posZ);
|
||||
supertile.getWorld().setBlockToAir(coords);
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorld().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(Block.getBlockFromName("sand")));
|
||||
EntityItem item = new EntityItem(supertile.getWorld(), coords.posX + 0.5, coords.posY + 0.5, coords.posZ + 0.5, new ItemStack(Items.clay_ball));
|
||||
supertile.getWorld().playAuxSFX(2001, coords, Block.getStateId(Blocks.sand.getDefaultState()));
|
||||
EntityItem item = new EntityItem(supertile.getWorld(), coords.getX() + 0.5, coords.getY() + 0.5, coords.getZ() + 0.5, new ItemStack(Items.clay_ball));
|
||||
supertile.getWorld().spawnEntityInWorld(item);
|
||||
mana -= manaCost;
|
||||
}
|
||||
@@ -55,12 +56,10 @@ public class SubTileClayconia extends SubTileFunctional {
|
||||
for(int i = -RANGE; i < RANGE + 1; i++)
|
||||
for(int j = -RANGE_Y; j < RANGE_Y + 1; j++)
|
||||
for(int k = -RANGE; k < RANGE + 1; k++) {
|
||||
int x = supertile.xCoord + i;
|
||||
int y = supertile.yCoord + j;
|
||||
int z = supertile.zCoord + k;
|
||||
Block block = supertile.getWorld().getBlock(x, y, z);
|
||||
BlockPos pos = supertile.getPos().add(i, j, k);
|
||||
Block block = supertile.getWorld().getBlockState(pos).getBlock();
|
||||
if(block == Block.getBlockFromName("sand"))
|
||||
possibleCoords.add(new BlockPos(x, y, z));
|
||||
possibleCoords.add(pos);
|
||||
}
|
||||
|
||||
if(possibleCoords.isEmpty())
|
||||
|
||||
+17
-18
@@ -17,7 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
@@ -30,15 +30,14 @@ public class SubTileDaffomill extends SubTileFunctional {
|
||||
private static final String TAG_WIND_TICKS = "windTicks";
|
||||
|
||||
int windTicks = 0;
|
||||
int orientation = 0;
|
||||
EnumFacing orientation = EnumFacing.NORTH;
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(orientation + 2);
|
||||
if(supertile.getWorld().rand.nextInt(4) == 0)
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.xCoord + Math.random(), supertile.yCoord + Math.random(), supertile.zCoord + Math.random(), 0.05F, 0.05F, 0.05F, 0.25F + (float) Math.random() * 0.15F, dir.offsetX * 0.1F, dir.offsetY * 0.1F, dir.offsetZ * 0.1F);
|
||||
Botania.proxy.wispFX(supertile.getWorld(), supertile.getPos().getX() + Math.random(), supertile.getPos().getY() + Math.random(), supertile.getPos().getZ() + Math.random(), 0.05F, 0.05F, 0.05F, 0.25F + (float) Math.random() * 0.15F, orientation.getFrontOffsetX() * 0.1F, orientation.getFrontOffsetY() * 0.1F, orientation.getFrontOffsetZ() * 0.1F);
|
||||
|
||||
if(windTicks == 0 && mana > 0) {
|
||||
windTicks = 20;
|
||||
@@ -51,9 +50,9 @@ public class SubTileDaffomill extends SubTileFunctional {
|
||||
if(axis != null) {
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, axis);
|
||||
for(EntityItem item : items) {
|
||||
item.motionX += dir.offsetX * 0.05;
|
||||
item.motionY += dir.offsetY * 0.05;
|
||||
item.motionZ += dir.offsetZ * 0.05;
|
||||
item.motionX += orientation.getFrontOffsetX() * 0.05;
|
||||
item.motionY += orientation.getFrontOffsetY() * 0.05;
|
||||
item.motionZ += orientation.getFrontOffsetZ() * 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,25 +61,25 @@ public class SubTileDaffomill extends SubTileFunctional {
|
||||
}
|
||||
|
||||
AxisAlignedBB aabbForOrientation() {
|
||||
int x = supertile.xCoord;
|
||||
int y = supertile.yCoord;
|
||||
int z = supertile.zCoord;
|
||||
int x = supertile.getPos().getX();
|
||||
int y = supertile.getPos().getY();
|
||||
int z = supertile.getPos().getZ();
|
||||
int w = 2;
|
||||
int h = 3;
|
||||
int l = 16;
|
||||
|
||||
AxisAlignedBB axis = null;
|
||||
switch(orientation) {
|
||||
case 0 :
|
||||
case NORTH :
|
||||
axis = new AxisAlignedBB(x - w, y - h, z - l, x + w + 1, y + h, z);
|
||||
break;
|
||||
case 1 :
|
||||
case SOUTH :
|
||||
axis = new AxisAlignedBB(x - w, y - h, z + 1, x + w + 1, y + h, z + l + 1);
|
||||
break;
|
||||
case 2 :
|
||||
case WEST :
|
||||
axis = new AxisAlignedBB(x - l, y - h, z - w, x, y + h, z + w + 1);
|
||||
break;
|
||||
case 3 :
|
||||
case EAST :
|
||||
axis = new AxisAlignedBB(x + 1, y - h, z - w, x + l + 1, y + h, z + w + 1);
|
||||
}
|
||||
return axis;
|
||||
@@ -98,7 +97,7 @@ public class SubTileDaffomill extends SubTileFunctional {
|
||||
|
||||
if(player.isSneaking()) {
|
||||
if(!player.worldObj.isRemote) {
|
||||
orientation = orientation == 3 ? 0 : orientation + 1;
|
||||
orientation = orientation.rotateY();
|
||||
sync();
|
||||
}
|
||||
|
||||
@@ -109,7 +108,7 @@ public class SubTileDaffomill extends SubTileFunctional {
|
||||
@Override
|
||||
public RadiusDescriptor getRadius() {
|
||||
AxisAlignedBB aabb = aabbForOrientation();
|
||||
aabb.minY = supertile.yCoord;
|
||||
aabb = new AxisAlignedBB(aabb.minX, supertile.getPos().getY(), aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ);
|
||||
return new RadiusDescriptor.Rectangle(toBlockPos(), aabb);
|
||||
}
|
||||
|
||||
@@ -132,7 +131,7 @@ public class SubTileDaffomill extends SubTileFunctional {
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
|
||||
cmp.setInteger(TAG_ORIENTATION, orientation);
|
||||
cmp.setInteger(TAG_ORIENTATION, orientation.getIndex() - 2); // retain compat with 1.7 saves
|
||||
cmp.setInteger(TAG_WIND_TICKS, windTicks);
|
||||
}
|
||||
|
||||
@@ -140,7 +139,7 @@ public class SubTileDaffomill extends SubTileFunctional {
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
super.readFromPacketNBT(cmp);
|
||||
|
||||
orientation = cmp.getInteger(TAG_ORIENTATION);
|
||||
orientation = EnumFacing.getFront(cmp.getInteger(TAG_ORIENTATION) + 2); // retain compat with 1.7 saves
|
||||
windTicks = cmp.getInteger(TAG_WIND_TICKS);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import net.minecraft.command.IEntitySelector;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
@@ -24,11 +25,11 @@ public class SubTileDreadthorn extends SubTileBellethorn {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntitySelector getSelector() {
|
||||
return new IEntitySelector() {
|
||||
public Predicate<Entity> getSelector() {
|
||||
return new Predicate<Entity>() {
|
||||
|
||||
@Override
|
||||
public boolean isEntityApplicable(Entity var1) {
|
||||
public boolean apply(Entity var1) {
|
||||
return var1 instanceof EntityAnimal && ((EntityAnimal) var1).getGrowingAge() == 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import vazkii.botania.api.item.IExoflameHeatable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
@@ -39,25 +40,23 @@ public class SubTileExoflame extends SubTileFunctional {
|
||||
for(int i = -RANGE; i < RANGE + 1; i++)
|
||||
for(int j = -RANGE_Y; j < RANGE_Y + 1; j++)
|
||||
for(int k = -RANGE; k < RANGE + 1; k++) {
|
||||
int x = supertile.xCoord + i;
|
||||
int y = supertile.yCoord + j;
|
||||
int z = supertile.zCoord + k;
|
||||
BlockPos pos = supertile.getPos().add(i, j, k);
|
||||
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(x, y, z);
|
||||
Block block = supertile.getWorld().getBlock(x, y, z);
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(pos);
|
||||
Block block = supertile.getWorld().getBlockState(pos).getBlock();
|
||||
if(tile != null) {
|
||||
if(tile instanceof TileEntityFurnace && (block == Blocks.furnace || block == Blocks.lit_furnace)) {
|
||||
TileEntityFurnace furnace = (TileEntityFurnace) tile;
|
||||
boolean canSmelt = canFurnaceSmelt(furnace);
|
||||
if(canSmelt && mana > 2) {
|
||||
if(furnace.furnaceBurnTime < 2) {
|
||||
if(furnace.furnaceBurnTime == 0)
|
||||
BlockFurnace.updateFurnaceBlockState(true, supertile.getWorld(), x, y, z);
|
||||
furnace.furnaceBurnTime = 200;
|
||||
if(furnace.getField(0) < 2) { // Field 0 -> Burn time
|
||||
if(furnace.getField(0) == 0)
|
||||
BlockFurnace.setState(true, supertile.getWorld(), pos);
|
||||
furnace.setField(0, 200);
|
||||
mana = Math.max(0, mana - cost);
|
||||
}
|
||||
if(ticksExisted % 2 == 0)
|
||||
furnace.furnaceCookTime = Math.min(199, furnace.furnaceCookTime + 1);
|
||||
furnace.setField(2, Math.min(199, furnace.getField(2) + 1)); // Field 2 -> cook time
|
||||
|
||||
did = true;
|
||||
|
||||
@@ -92,7 +91,7 @@ public class SubTileExoflame extends SubTileFunctional {
|
||||
if(furnace.getStackInSlot(0) == null)
|
||||
return false;
|
||||
else {
|
||||
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnace.getStackInSlot(0));
|
||||
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(furnace.getStackInSlot(0));
|
||||
|
||||
if(itemstack == null)
|
||||
return false;
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ public class SubTileFallenKanade extends SubTileFunctional {
|
||||
|
||||
final int cost = 120;
|
||||
|
||||
if(!supertile.getWorld().isRemote && supertile.getWorld().provider.dimensionId != 1) {
|
||||
List<EntityPlayer> players = supertile.getWorld().getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(supertile.xCoord - RANGE, supertile.yCoord - RANGE, supertile.zCoord - RANGE, supertile.xCoord + RANGE + 1, supertile.yCoord + RANGE + 1, supertile.zCoord + RANGE + 1));
|
||||
if(!supertile.getWorld().isRemote && supertile.getWorld().provider.getDimensionId() != 1) {
|
||||
List<EntityPlayer> players = supertile.getWorld().getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
for(EntityPlayer player : players) {
|
||||
if(player.getActivePotionEffect(Potion.regeneration) == null && mana >= cost ) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 60, 2));
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class SubTileHeiseiDream extends SubTileFunctional {
|
||||
|
||||
final int cost = 100;
|
||||
|
||||
List<IMob> mobs = supertile.getWorld().getEntitiesWithinAABB(IMob.class, new AxisAlignedBB(supertile.xCoord - RANGE, supertile.yCoord - RANGE, supertile.zCoord - RANGE, supertile.xCoord + RANGE + 1, supertile.yCoord + RANGE + 1, supertile.zCoord + RANGE + 1));
|
||||
List<IMob> mobs = supertile.getWorld().getEntitiesWithinAABB(IMob.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
if(mobs.size() > 1 && mana >= cost)
|
||||
for(IMob mob : mobs) {
|
||||
if(mob instanceof EntityLiving) {
|
||||
|
||||
+19
-27
@@ -25,8 +25,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -59,29 +60,25 @@ public class SubTileHopperhock extends SubTileFunctional {
|
||||
boolean pulledAny = false;
|
||||
int range = getRange();
|
||||
|
||||
int x = supertile.xCoord;
|
||||
int y = supertile.yCoord;
|
||||
int z = supertile.zCoord;
|
||||
BlockPos pos = supertile.getPos();
|
||||
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(x - range, y - range, z - range, x + range + 1, y + range + 1, z + range + 1));
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos.add(-range, -range, -range), pos.add(range + 1, range + 1, range + 1)));
|
||||
for(EntityItem item : items) {
|
||||
if(item.age < 60 || item.age >= 105 && item.age < 110 || item.isDead)
|
||||
if(item.getAge() < 60 || item.getAge() >= 105 && item.getAge() < 110 || item.isDead)
|
||||
continue;
|
||||
|
||||
ItemStack stack = item.getEntityItem();
|
||||
|
||||
IInventory invToPutItemIn = null;
|
||||
ForgeDirection sideToPutItemIn = ForgeDirection.UNKNOWN;
|
||||
EnumFacing sideToPutItemIn = null;
|
||||
boolean priorityInv = false;
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
int x_ = x + dir.offsetX;
|
||||
int y_ = y + dir.offsetY;
|
||||
int z_ = z + dir.offsetZ;
|
||||
for(EnumFacing dir : EnumFacing.VALUES) {
|
||||
BlockPos pos_ = pos.offset(dir);
|
||||
|
||||
IInventory inv = InventoryHelper.getInventory(supertile.getWorld(), , x_);
|
||||
IInventory inv = InventoryHelper.getInventory(supertile.getWorld(), pos_, dir);
|
||||
if(inv != null) {
|
||||
List<ItemStack> filter = getFilterForInventory(inv, x_, y_, z_, true);
|
||||
List<ItemStack> filter = getFilterForInventory(inv, pos_, true);
|
||||
boolean canAccept = canAcceptItem(stack, filter, filterType);
|
||||
int stackSize = InventoryHelper.testInventoryInsertion(inv, stack, dir);
|
||||
canAccept &= stackSize == stack.stackSize;
|
||||
@@ -149,31 +146,26 @@ public class SubTileHopperhock extends SubTileFunctional {
|
||||
}
|
||||
}
|
||||
|
||||
public List<ItemStack> getFilterForInventory(IInventory inv, int x, int y, int z, boolean recursiveForDoubleChests) {
|
||||
public List<ItemStack> getFilterForInventory(IInventory inv, BlockPos pos, boolean recursiveForDoubleChests) {
|
||||
List<ItemStack> filter = new ArrayList();
|
||||
|
||||
if(recursiveForDoubleChests) {
|
||||
TileEntity tileEntity = supertile.getWorld().getTileEntity(x, y, z);
|
||||
Block chest = supertile.getWorld().getBlock(x, y, z);
|
||||
TileEntity tileEntity = supertile.getWorld().getTileEntity(pos);
|
||||
Block chest = supertile.getWorld().getBlockState(pos).getBlock();
|
||||
|
||||
if(tileEntity instanceof TileEntityChest)
|
||||
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS)
|
||||
if(supertile.getWorld().getBlock(x + dir.offsetX, y, z + dir.offsetZ) == chest) {
|
||||
filter.addAll(getFilterForInventory((IInventory) supertile.getWorld().getTileEntity(x + dir.offsetX, y, z + dir.offsetZ), x + dir.offsetX, y, z + dir.offsetZ, false));
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS)
|
||||
if(supertile.getWorld().getBlockState(pos.offset(dir)).getBlock() == chest) {
|
||||
filter.addAll(getFilterForInventory((IInventory) supertile.getWorld().getTileEntity(pos.offset(dir)), pos.offset(dir), false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final int[] orientationToDir = new int[] {
|
||||
3, 4, 2, 5
|
||||
};
|
||||
|
||||
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, x + dir.offsetX + 1, y + dir.offsetY + 1, z + dir.offsetZ + 1);
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(pos.offset(dir), pos.offset(dir).add(1, 1, 1));
|
||||
List<EntityItemFrame> frames = supertile.getWorld().getEntitiesWithinAABB(EntityItemFrame.class, aabb);
|
||||
for(EntityItemFrame frame : frames) {
|
||||
int orientation = frame.hangingDirection;
|
||||
if(orientationToDir[orientation] == dir.ordinal())
|
||||
if(frame.facingDirection == dir)
|
||||
filter.add(frame.getDisplayedItem());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SubTileHyacidus extends SubTileFunctional {
|
||||
|
||||
final int cost = 20;
|
||||
|
||||
List<EntityLivingBase> entities = supertile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(supertile.xCoord - RANGE, supertile.yCoord - RANGE, supertile.zCoord - RANGE, supertile.xCoord + RANGE + 1, supertile.yCoord + RANGE + 1, supertile.zCoord + RANGE + 1));
|
||||
List<EntityLivingBase> entities = supertile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
for(EntityLivingBase entity : entities) {
|
||||
if(!(entity instanceof EntityPlayer) && entity.getActivePotionEffect(Potion.poison) == null && mana >= cost && !entity.worldObj.isRemote && entity.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.poison.id, 60, 0));
|
||||
|
||||
+12
-9
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
@@ -32,18 +33,20 @@ public class SubTileJadedAmaranthus extends SubTileFunctional {
|
||||
return;
|
||||
|
||||
if(mana >= COST && !supertile.getWorld().isRemote && ticksExisted % 30 == 0) {
|
||||
int x = supertile.xCoord - RANGE + supertile.getWorld().rand.nextInt(RANGE * 2 + 1);
|
||||
int y = supertile.yCoord + RANGE;
|
||||
int z = supertile.zCoord - RANGE + supertile.getWorld().rand.nextInt(RANGE * 2 + 1);
|
||||
BlockPos pos = new BlockPos(
|
||||
supertile.getPos().getX() - RANGE + supertile.getWorld().rand.nextInt(RANGE * 2 + 1),
|
||||
supertile.getPos().getY() + RANGE,
|
||||
supertile.getPos().getZ() - RANGE + supertile.getWorld().rand.nextInt(RANGE * 2 + 1)
|
||||
);
|
||||
|
||||
for(int i = 0; i < RANGE * 2; i++) {
|
||||
Block blockAbove = supertile.getWorld().getBlock(x, y + 1, z);
|
||||
if((supertile.getWorld().isAirBlock(x, y + 1, z) || blockAbove.isReplaceable(supertile.getWorld(), x, y + 1, z)) && blockAbove.getMaterial() != Material.water && ModBlocks.flower.canPlaceBlockAt(supertile.getWorld(), x, y + 1, z)) {
|
||||
Block blockAbove = supertile.getWorld().getBlockState(pos.up()).getBlock();
|
||||
if((supertile.getWorld().isAirBlock(pos.up()) || blockAbove.isReplaceable(supertile.getWorld(), pos.up())) && blockAbove.getMaterial() != Material.water && ModBlocks.flower.canPlaceBlockAt(supertile.getWorld(), pos.up())) {
|
||||
int color = supertile.getWorld().rand.nextInt(16);
|
||||
if(ModBlocks.flower.canBlockStay(supertile.getWorld(), x, y + 1, z)) {
|
||||
if(ModBlocks.flower.canPlaceBlockAt(supertile.getWorld(), pos.up())) {
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorld().playAuxSFX(2001, x, y + 1, z, Block.getIdFromBlock(ModBlocks.flower) + (color << 12));
|
||||
supertile.getWorld().setBlock(x, y + 1, z, ModBlocks.flower, color, 1 | 2);
|
||||
supertile.getWorld().playAuxSFX(2001, pos.up(), Block.getIdFromBlock(ModBlocks.flower) + (color << 12));
|
||||
supertile.getWorld().setBlockState(pos.up(), ModBlocks.flower, color, 1 | 2);
|
||||
}
|
||||
|
||||
mana -= COST;
|
||||
@@ -52,7 +55,7 @@ public class SubTileJadedAmaranthus extends SubTileFunctional {
|
||||
break;
|
||||
}
|
||||
|
||||
y--;
|
||||
pos = pos.down();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SubTileLoonuim extends SubTileFunctional {
|
||||
} while(stack == null || BotaniaAPI.looniumBlacklist.contains(stack.getItem()));
|
||||
|
||||
int bound = RANGE * 2 + 1;
|
||||
EntityItem entity = new EntityItem(supertile.getWorld(), supertile.xCoord - RANGE + rand.nextInt(bound) , supertile.yCoord + 1, supertile.zCoord - RANGE + rand.nextInt(bound), stack);
|
||||
EntityItem entity = new EntityItem(supertile.getWorld(), supertile.getPos().getX() - RANGE + rand.nextInt(bound) , supertile.getPos().getY() + 1, supertile.getPos().getZ() - RANGE + rand.nextInt(bound), stack);
|
||||
entity.motionX = 0;
|
||||
entity.motionY = 0;
|
||||
entity.motionZ = 0;
|
||||
|
||||
+8
-9
@@ -15,6 +15,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.pattern.BlockHelper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
@@ -60,9 +61,9 @@ public class SubTileMarimorphosis extends SubTileFunctional {
|
||||
if(stack != null) {
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
int meta = stack.getItemDamage();
|
||||
supertile.getWorld().setBlock(coords.posX, coords.posY, coords.posZ, block, meta, 1 | 2);
|
||||
supertile.getWorld().setBlockState(coords, block.getStateFromMeta(meta), 1 | 2);
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorld().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(block) + (meta << 12));
|
||||
supertile.getWorld().playAuxSFX(2001, coords, Block.getIdFromBlock(block) + (meta << 12));
|
||||
|
||||
mana -= COST;
|
||||
sync();
|
||||
@@ -72,7 +73,7 @@ public class SubTileMarimorphosis extends SubTileFunctional {
|
||||
}
|
||||
|
||||
public ItemStack getStoneToPut(BlockPos coords) {
|
||||
List<Type> types = Arrays.asList(BiomeDictionary.getTypesForBiome(supertile.getWorld().getBiomeGenForCoords(coords.posX, coords.posZ)));
|
||||
List<Type> types = Arrays.asList(BiomeDictionary.getTypesForBiome(supertile.getWorld().getBiomeGenForCoords(coords)));
|
||||
|
||||
List<Integer> values = new ArrayList();
|
||||
for(int i = 0; i < 8; i++) {
|
||||
@@ -96,12 +97,10 @@ public class SubTileMarimorphosis extends SubTileFunctional {
|
||||
for(int i = -range; i < range + 1; i++)
|
||||
for(int j = -range; j < rangeY; j++)
|
||||
for(int k = -range; k < range + 1; k++) {
|
||||
int x = supertile.xCoord + i;
|
||||
int y = supertile.yCoord + j;
|
||||
int z = supertile.zCoord + k;
|
||||
Block block = supertile.getWorld().getBlock(x, y, z);
|
||||
if(block != null && block.isReplaceableOreGen(supertile.getWorld(), x, y, z, Blocks.stone))
|
||||
possibleCoords.add(new BlockPos(x, y, z));
|
||||
BlockPos pos = supertile.getPos().add(i, j, k);
|
||||
Block block = supertile.getWorld().getBlockState(pos).getBlock();
|
||||
if(block != null && block.isReplaceableOreGen(supertile.getWorld(), pos, BlockHelper.forBlock(Blocks.stone)))
|
||||
possibleCoords.add(pos);
|
||||
}
|
||||
|
||||
if(possibleCoords.isEmpty())
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SubTileMedumone extends SubTileFunctional {
|
||||
super.onUpdate();
|
||||
|
||||
if(mana > 0) {
|
||||
List<EntityLivingBase> entities = supertile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(supertile.xCoord - RANGE, supertile.yCoord, supertile.zCoord - RANGE, supertile.xCoord + RANGE + 1, supertile.yCoord + 1, supertile.zCoord + RANGE + 1));
|
||||
List<EntityLivingBase> entities = supertile.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
|
||||
for(EntityLivingBase entity : entities)
|
||||
if(!(entity instanceof EntityPlayer)) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.pattern.BlockHelper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -54,10 +55,10 @@ public class SubTileOrechid extends SubTileFunctional {
|
||||
if(stack != null) {
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
int meta = stack.getItemDamage();
|
||||
supertile.getWorld().setBlock(coords.posX, coords.posY, coords.posZ, block, meta, 1 | 2);
|
||||
supertile.getWorld().setBlockState(coords, block.getStateFromMeta(meta), 1 | 2);
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorld().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(block) + (meta << 12));
|
||||
supertile.getWorld().playSoundEffect(supertile.xCoord, supertile.yCoord, supertile.zCoord, "botania:orechid", 2F, 1F);
|
||||
supertile.getWorld().playAuxSFX(2001, coords, Block.getIdFromBlock(block) + (meta << 12));
|
||||
supertile.getWorld().playSoundEffect(supertile.getPos().getX(), supertile.getPos().getY(), supertile.getPos().getZ(), "botania:orechid", 2F, 1F);
|
||||
|
||||
mana -= cost;
|
||||
sync();
|
||||
@@ -103,12 +104,10 @@ public class SubTileOrechid extends SubTileFunctional {
|
||||
for(int i = -RANGE; i < RANGE + 1; i++)
|
||||
for(int j = -RANGE_Y; j < RANGE_Y; j++)
|
||||
for(int k = -RANGE; k < RANGE + 1; k++) {
|
||||
int x = supertile.xCoord + i;
|
||||
int y = supertile.yCoord + j;
|
||||
int z = supertile.zCoord + k;
|
||||
Block block = supertile.getWorld().getBlock(x, y, z);
|
||||
if(block != null && block.isReplaceableOreGen(supertile.getWorld(), x, y, z, source))
|
||||
possibleCoords.add(new BlockPos(x, y, z));
|
||||
BlockPos pos = supertile.getPos().add(i, j, k);
|
||||
Block block = supertile.getWorld().getBlockState(pos).getBlock();
|
||||
if(block != null && block.isReplaceableOreGen(supertile.getWorld(), pos, BlockHelper.forBlock(source)))
|
||||
possibleCoords.add(pos);
|
||||
}
|
||||
|
||||
if(possibleCoords.isEmpty())
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public class SubTileOrechidIgnem extends SubTileOrechid {
|
||||
|
||||
@Override
|
||||
public boolean canOperate() {
|
||||
return supertile.getWorld().provider.isHellWorld;
|
||||
return supertile.getWorld().provider.doesWaterVaporize();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -34,8 +34,8 @@ public class SubTilePollidisiac extends SubTileFunctional {
|
||||
if(!supertile.getWorld().isRemote) {
|
||||
int manaCost = 12;
|
||||
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(supertile.xCoord - RANGE, supertile.yCoord, supertile.zCoord - RANGE, supertile.xCoord + 1 + RANGE, supertile.yCoord + 1, supertile.zCoord + 1 +RANGE));
|
||||
List<EntityAnimal> animals = supertile.getWorld().getEntitiesWithinAABB(EntityAnimal.class, new AxisAlignedBB(supertile.xCoord - RANGE, supertile.yCoord, supertile.zCoord - RANGE, supertile.xCoord + 1 +RANGE, supertile.yCoord + 1, supertile.zCoord + 1 +RANGE));
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
List<EntityAnimal> animals = supertile.getWorld().getEntitiesWithinAABB(EntityAnimal.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
for(EntityAnimal animal : animals) {
|
||||
if(mana < manaCost)
|
||||
break;
|
||||
@@ -43,7 +43,7 @@ public class SubTilePollidisiac extends SubTileFunctional {
|
||||
int love = ReflectionHelper.getPrivateValue(EntityAnimal.class, animal, LibObfuscation.IN_LOVE);
|
||||
if(animal.getGrowingAge() == 0 && love <= 0) {
|
||||
for(EntityItem item : items) {
|
||||
if(item.age < 60 || item.isDead)
|
||||
if(item.getAge() < 60 || item.isDead)
|
||||
continue;
|
||||
|
||||
ItemStack stack = item.getEntityItem();
|
||||
|
||||
+27
-39
@@ -14,10 +14,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -73,13 +73,11 @@ public class SubTileRannuncarpus extends SubTileFunctional {
|
||||
int rangePlace = getRange();
|
||||
int rangePlaceY = getRangeY();
|
||||
|
||||
int x = supertile.xCoord;
|
||||
int y = supertile.yCoord;
|
||||
int z = supertile.zCoord;
|
||||
BlockPos pos = supertile.getPos();
|
||||
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(x - RANGE, y - RANGE_Y, z - RANGE, x + RANGE + 1, y + RANGE_Y, z + RANGE + 1));
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE_Y, -RANGE), supertile.getPos().add(RANGE + 1, RANGE_Y + 1, RANGE + 1)));
|
||||
for(EntityItem item : items) {
|
||||
if(item.age < 60 || item.isDead)
|
||||
if(item.getAge() < 60 || item.isDead)
|
||||
continue;
|
||||
|
||||
ItemStack stack = item.getEntityItem();
|
||||
@@ -89,56 +87,48 @@ public class SubTileRannuncarpus extends SubTileFunctional {
|
||||
for(int i = -rangePlace; i < rangePlace + 1; i++)
|
||||
for(int j = -rangePlaceY; j < rangePlaceY + 1; j++)
|
||||
for(int l = -rangePlace; l < rangePlace + 1; l++) {
|
||||
int xp = x + i;
|
||||
int yp = y + j;
|
||||
int zp = z + l;
|
||||
Block blockAbove = supertile.getWorld().getBlock(xp, yp + 1, zp);
|
||||
BlockPos pos_ = pos.add(i, j, l);
|
||||
Block blockAbove = supertile.getWorld().getBlockState(pos_.up()).getBlock();
|
||||
|
||||
if(filter.equals(supertile.getWorld(), xp, yp, zp) && (blockAbove.isAir(supertile.getWorld(), xp, yp + 1, zp) || blockAbove.isReplaceable(supertile.getWorld(), xp, yp + 1, zp)))
|
||||
validPositions.add(new BlockPos(xp, yp + 1, zp));
|
||||
if(filter.equals(supertile.getWorld(), pos_) && (blockAbove.isAir(supertile.getWorld(), pos_.up()) || blockAbove.isReplaceable(supertile.getWorld(), pos_.up())))
|
||||
validPositions.add(pos_.up());
|
||||
}
|
||||
|
||||
scanned = true;
|
||||
}
|
||||
|
||||
|
||||
if(!validPositions.isEmpty() && !supertile.getWorldObj().isRemote) {
|
||||
ChunkCoordinates coords = validPositions.get(supertile.getWorldObj().rand.nextInt(validPositions.size()));
|
||||
if(!validPositions.isEmpty() && !supertile.getWorld().isRemote) {
|
||||
BlockPos coords = validPositions.get(supertile.getWorld().rand.nextInt(validPositions.size()));
|
||||
|
||||
Block blockToPlace = null;
|
||||
if(stackItem instanceof IFlowerPlaceable)
|
||||
blockToPlace = ((IFlowerPlaceable) stackItem).getBlockToPlaceByFlower(stack, this, coords.posX, coords.posY, coords.posZ);
|
||||
blockToPlace = ((IFlowerPlaceable) stackItem).getBlockToPlaceByFlower(stack, this, coords);
|
||||
if(stackItem instanceof ItemBlock)
|
||||
blockToPlace = ((ItemBlock) stackItem).field_150939_a;
|
||||
blockToPlace = ((ItemBlock) stackItem).block;
|
||||
else if(stackItem instanceof ItemReed)
|
||||
blockToPlace = ReflectionHelper.getPrivateValue(ItemReed.class, (ItemReed) stackItem, LibObfuscation.REED_ITEM);
|
||||
else if(stackItem instanceof ItemRedstone)
|
||||
blockToPlace = Blocks.redstone_wire;
|
||||
|
||||
if(blockToPlace != null) {
|
||||
<<<<<<< HEAD
|
||||
BlockPos coords = validPositions.get(supertile.getWorld().rand.nextInt(validPositions.size()));
|
||||
if(blockToPlace.canPlaceBlockAt(supertile.getWorld(), coords.posX, coords.posY, coords.posZ)) {
|
||||
supertile.getWorld().setBlock(coords.posX, coords.posY, coords.posZ, blockToPlace, stack.getItemDamage(), 1 | 2);
|
||||
=======
|
||||
if(blockToPlace.canPlaceBlockAt(supertile.getWorldObj(), coords.posX, coords.posY, coords.posZ)) {
|
||||
supertile.getWorldObj().setBlock(coords.posX, coords.posY, coords.posZ, blockToPlace, stack.getItemDamage(), 1 | 2);
|
||||
>>>>>>> 82051d95d9817a177f0ec62817f4f2430358b46e
|
||||
if(blockToPlace.canPlaceBlockAt(supertile.getWorld(), coords)) {
|
||||
supertile.getWorld().setBlockState(coords, blockToPlace.getStateFromMeta(stack.getItemDamage()), 1 | 2);
|
||||
if(ConfigHandler.blockBreakParticles)
|
||||
supertile.getWorld().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(blockToPlace) + (stack.getItemDamage() << 12));
|
||||
supertile.getWorld().playAuxSFX(2001, coords, Block.getStateId(blockToPlace.getStateFromMeta(stack.getItemDamage())));
|
||||
validPositions.remove(coords);
|
||||
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(coords.posX, coords.posY, coords.posZ);
|
||||
TileEntity tile = supertile.getWorld().getTileEntity(coords);
|
||||
if(tile != null && tile instanceof ISubTileContainer) {
|
||||
ISubTileContainer container = (ISubTileContainer) tile;
|
||||
String subtileName = ItemBlockSpecialFlower.getType(stack);
|
||||
container.setSubTile(subtileName);
|
||||
SubTileEntity subtile = container.getSubTile();
|
||||
subtile.onBlockPlacedBy(supertile.getWorld(), coords.posX, coords.posY, coords.posZ, null, stack);
|
||||
subtile.onBlockPlacedBy(supertile.getWorld(), coords, supertile.getWorld().getBlockState(coords), null, stack);
|
||||
}
|
||||
|
||||
if(stackItem instanceof IFlowerPlaceable)
|
||||
((IFlowerPlaceable) stackItem).onBlockPlacedByFlower(stack, this, coords.posX, coords.posY, coords.posZ);
|
||||
((IFlowerPlaceable) stackItem).onBlockPlacedByFlower(stack, this, coords);
|
||||
|
||||
if(!supertile.getWorld().isRemote) {
|
||||
stack.stackSize--;
|
||||
@@ -158,7 +148,7 @@ public class SubTileRannuncarpus extends SubTileFunctional {
|
||||
}
|
||||
|
||||
public BlockData getUnderlyingBlock() {
|
||||
return new BlockData(supertile.getWorld(), supertile.xCoord, supertile.yCoord - (supertile instanceof IFloatingFlower ? 1 : 2), supertile.zCoord);
|
||||
return new BlockData(supertile.getWorld(), supertile.getPos().down(supertile instanceof IFloatingFlower ? 1 : 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -171,7 +161,7 @@ public class SubTileRannuncarpus extends SubTileFunctional {
|
||||
super.renderHUD(mc, res);
|
||||
|
||||
BlockData filter = getUnderlyingBlock();
|
||||
ItemStack recieverStack = new ItemStack(Item.getItemFromBlock(filter.block), 1, filter.meta);
|
||||
ItemStack recieverStack = new ItemStack(Item.getItemFromBlock(filter.state.getBlock()), 1, filter.state.getBlock().getMetaFromState(filter.state));
|
||||
int color = getColor();
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -184,7 +174,7 @@ public class SubTileRannuncarpus extends SubTileFunctional {
|
||||
|
||||
mc.fontRendererObj.drawStringWithShadow(stackName, x + 20, y + 5, color);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recieverStack, x, y);
|
||||
mc.getRenderItem().renderItemAndEffectIntoGUI(recieverStack, x, y);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
@@ -227,20 +217,18 @@ public class SubTileRannuncarpus extends SubTileFunctional {
|
||||
|
||||
static class BlockData {
|
||||
|
||||
Block block;
|
||||
int meta;
|
||||
final IBlockState state;
|
||||
|
||||
public BlockData(World world, int x, int y, int z) {
|
||||
block = world.getBlock(x, y, z);
|
||||
meta = world.getBlockMetadata(x, y, z);
|
||||
public BlockData(World world, BlockPos pos) {
|
||||
state = world.getBlockState(pos);
|
||||
}
|
||||
|
||||
public boolean equals(BlockData data) {
|
||||
return block == data.block && meta == data.meta;
|
||||
return this.state == data.state;
|
||||
}
|
||||
|
||||
public boolean equals(World world, int x, int y, int z) {
|
||||
return equals(new BlockData(world, x, y, z));
|
||||
public boolean equals(World world, BlockPos pos) {
|
||||
return equals(new BlockData(world, pos));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ public class SubTileSolegnolia extends SubTileFunctional {
|
||||
|
||||
public static boolean hasSolegnoliaAround(Entity e) {
|
||||
for(SubTileSolegnolia flower : existingFlowers) {
|
||||
if(flower.mana == 0 || flower.redstoneSignal > 0 || flower.supertile.getWorld() != e.worldObj || flower.supertile.getWorld().getTileEntity(flower.supertile.xCoord, flower.supertile.yCoord, flower.supertile.zCoord) != flower.supertile)
|
||||
if(flower.mana == 0 || flower.redstoneSignal > 0 || flower.supertile.getWorld() != e.worldObj || flower.supertile.getWorld().getTileEntity(flower.supertile.getPos()) != flower.supertile)
|
||||
continue;
|
||||
|
||||
double range = flower.getRange();
|
||||
if(MathHelper.pointDistanceSpace(e.posX, e.posY, e.posZ, flower.supertile.xCoord + 0.5, flower.supertile.yCoord + 0.5, flower.supertile.zCoord + 0.5) <= range)
|
||||
if(MathHelper.pointDistanceSpace(e.posX, e.posY, e.posZ, flower.supertile.getPos().getX() + 0.5, flower.supertile.getPos().getY() + 0.5, flower.supertile.getPos().getZ() + 0.5) <= range)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+19
-23
@@ -18,10 +18,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
import vazkii.botania.api.subtile.RadiusDescriptor;
|
||||
@@ -43,21 +41,19 @@ public class SubTileSpectranthemum extends SubTileFunctional {
|
||||
|
||||
private static final String TAG_TELEPORTED = "Botania_TPd";
|
||||
|
||||
int bindX, bindY = -1, bindZ;
|
||||
BlockPos bindPos = new BlockPos(0, -1, 0);
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(redstoneSignal == 0 && supertile.getWorld().blockExists(bindX, bindY, bindZ)) {
|
||||
int x = supertile.xCoord;
|
||||
int y = supertile.yCoord;
|
||||
int z = supertile.zCoord;
|
||||
if(redstoneSignal == 0 && supertile.getWorld().isBlockLoaded(bindPos)) {
|
||||
BlockPos pos = supertile.getPos();
|
||||
|
||||
boolean did = false;
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(x - RANGE, y - RANGE, z - RANGE, x + RANGE + 1, y + RANGE, z + RANGE + 1));
|
||||
List<EntityItem> items = supertile.getWorld().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
|
||||
for(EntityItem item : items) {
|
||||
if(item.age < 60 || item.isDead || item.getEntityData().getBoolean(TAG_TELEPORTED))
|
||||
if(item.getAge() < 60 || item.isDead || item.getEntityData().getBoolean(TAG_TELEPORTED))
|
||||
continue;
|
||||
|
||||
ItemStack stack = item.getEntityItem();
|
||||
@@ -69,7 +65,7 @@ public class SubTileSpectranthemum extends SubTileFunctional {
|
||||
int cost = stack.stackSize * COST;
|
||||
if(mana >= cost) {
|
||||
spawnExplosionParticles(item);
|
||||
item.setPosition(bindX + 0.5, bindY + 1.5, bindZ + 0.5);
|
||||
item.setPosition(bindPos.getX() + 0.5, bindPos.getY() + 1.5, bindPos.getZ() + 0.5);
|
||||
item.getEntityData().setBoolean(TAG_TELEPORTED, true);
|
||||
item.motionX = item.motionY = item.motionZ = 0;
|
||||
spawnExplosionParticles(item);
|
||||
@@ -93,7 +89,7 @@ public class SubTileSpectranthemum extends SubTileFunctional {
|
||||
double d1 = item.worldObj.rand.nextGaussian() * m;
|
||||
double d2 = item.worldObj.rand.nextGaussian() * m;
|
||||
double d3 = 10.0D;
|
||||
item.worldObj.spawnParticle("explode", item.posX + item.worldObj.rand.nextFloat() * item.width * 2.0F - item.width - d0 * d3, item.posY + item.worldObj.rand.nextFloat() * item.height - d1 * d3, item.posZ + item.worldObj.rand.nextFloat() * item.width * 2.0F - item.width - d2 * d3, d0, d1, d2);
|
||||
item.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, item.posX + item.worldObj.rand.nextFloat() * item.width * 2.0F - item.width - d0 * d3, item.posY + item.worldObj.rand.nextFloat() * item.height - d1 * d3, item.posZ + item.worldObj.rand.nextFloat() * item.width * 2.0F - item.width - d2 * d3, d0, d1, d2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,17 +101,19 @@ public class SubTileSpectranthemum extends SubTileFunctional {
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
super.writeToPacketNBT(cmp);
|
||||
cmp.setInteger(TAG_BIND_X, bindX);
|
||||
cmp.setInteger(TAG_BIND_Y, bindY);
|
||||
cmp.setInteger(TAG_BIND_Z, bindZ);
|
||||
cmp.setInteger(TAG_BIND_X, bindPos.getX());
|
||||
cmp.setInteger(TAG_BIND_Y, bindPos.getY());
|
||||
cmp.setInteger(TAG_BIND_Z, bindPos.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
super.readFromPacketNBT(cmp);
|
||||
bindX = cmp.getInteger(TAG_BIND_X);
|
||||
bindY = cmp.getInteger(TAG_BIND_Y);
|
||||
bindZ = cmp.getInteger(TAG_BIND_Z);
|
||||
bindPos = new BlockPos(
|
||||
cmp.getInteger(TAG_BIND_X),
|
||||
cmp.getInteger(TAG_BIND_Y),
|
||||
cmp.getInteger(TAG_BIND_Z)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,10 +135,8 @@ public class SubTileSpectranthemum extends SubTileFunctional {
|
||||
public boolean bindTo(EntityPlayer player, ItemStack wand, BlockPos pos, EnumFacing side) {
|
||||
boolean bound = super.bindTo(player, wand, pos, side);
|
||||
|
||||
if(!bound && (x != bindX || y != bindY || z != bindZ) && MathHelper.pointDistanceSpace(x, y, z, supertile.xCoord, supertile.yCoord, supertile.zCoord) <= BIND_RANGE && (x != supertile.xCoord || y != supertile.yCoord || z != supertile.zCoord)) {
|
||||
bindX = x;
|
||||
bindY = y;
|
||||
bindZ = z;
|
||||
if(!bound && !pos.equals(bindPos) && MathHelper.pointDistanceSpace(pos, supertile.getPos()) <= BIND_RANGE && !(pos.equals(supertile.getPos()))) {
|
||||
bindPos = pos;
|
||||
sync();
|
||||
|
||||
return true;
|
||||
@@ -152,7 +148,7 @@ public class SubTileSpectranthemum extends SubTileFunctional {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockPos getBinding() {
|
||||
return Minecraft.getMinecraft().thePlayer.isSneaking() && bindY != -1 ? new BlockPos(bindX, bindY, bindZ) : super.getBinding();
|
||||
return Minecraft.getMinecraft().thePlayer.isSneaking() && bindPos.getY() != -1 ? bindPos : super.getBinding();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -31,9 +31,9 @@ public class SubTileTangleberrie extends SubTileFunctional {
|
||||
super.onUpdate();
|
||||
|
||||
if(mana > 0) {
|
||||
double x1 = supertile.xCoord + 0.5;
|
||||
double y1 = supertile.yCoord + 0.5;
|
||||
double z1 = supertile.zCoord + 0.5;
|
||||
double x1 = supertile.getPos().getX() + 0.5;
|
||||
double y1 = supertile.getPos().getY() + 0.5;
|
||||
double z1 = supertile.getPos().getZ() + 0.5;
|
||||
|
||||
double maxDist = getMaxDistance();
|
||||
double range = getRange();
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SubTileTigerseye extends SubTileFunctional {
|
||||
|
||||
boolean shouldAfffect = mana >= cost;
|
||||
|
||||
List<EntityLiving> entities = supertile.getWorld().getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB(supertile.xCoord - RANGE, supertile.yCoord - RANGE_Y, supertile.zCoord - RANGE, supertile.xCoord + RANGE + 1, supertile.yCoord + RANGE_Y + 1, supertile.zCoord + RANGE + 1));
|
||||
List<EntityLiving> entities = supertile.getWorld().getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE_Y, -RANGE), supertile.getPos().add(RANGE + 1, RANGE_Y + 1, RANGE + 1)));
|
||||
|
||||
for(EntityLiving entity : entities) {
|
||||
List<EntityAITaskEntry> entries = new ArrayList(entity.tasks.taskEntries);
|
||||
|
||||
@@ -82,12 +82,12 @@ public class SubTileVinculotus extends SubTileFunctional {
|
||||
if(event.entity instanceof EntityEnderman) {
|
||||
List<SubTileVinculotus> possibleFlowers = new ArrayList();
|
||||
for(SubTileVinculotus flower : existingFlowers) {
|
||||
if(flower.redstoneSignal > 0 || flower.mana <= cost || flower.supertile.getWorld() != event.entity.worldObj || flower.supertile.getWorld().getTileEntity(flower.supertile.xCoord, flower.supertile.yCoord, flower.supertile.zCoord) != flower.supertile)
|
||||
if(flower.redstoneSignal > 0 || flower.mana <= cost || flower.supertile.getWorld() != event.entity.worldObj || flower.supertile.getWorld().getTileEntity(flower.supertile.getPos()) != flower.supertile)
|
||||
continue;
|
||||
|
||||
double x = flower.supertile.xCoord + 0.5;
|
||||
double y = flower.supertile.yCoord + 1.5;
|
||||
double z = flower.supertile.zCoord + 0.5;
|
||||
double x = flower.supertile.getPos().getX() + 0.5;
|
||||
double y = flower.supertile.getPos().getY() + 1.5;
|
||||
double z = flower.supertile.getPos().getZ() + 0.5;
|
||||
|
||||
if(MathHelper.pointDistanceSpace(x, y, z, event.targetX, event.targetY, event.targetZ) < RANGE)
|
||||
possibleFlowers.add(flower);
|
||||
@@ -96,9 +96,9 @@ public class SubTileVinculotus extends SubTileFunctional {
|
||||
if(!possibleFlowers.isEmpty()) {
|
||||
SubTileVinculotus flower = possibleFlowers.get(event.entity.worldObj.rand.nextInt(possibleFlowers.size()));
|
||||
|
||||
double x = flower.supertile.xCoord + 0.5;
|
||||
double y = flower.supertile.yCoord + 1.5;
|
||||
double z = flower.supertile.zCoord + 0.5;
|
||||
double x = flower.supertile.getPos().getX() + 0.5;
|
||||
double y = flower.supertile.getPos().getY() + 1.5;
|
||||
double z = flower.supertile.getPos().getZ() + 0.5;
|
||||
|
||||
event.targetX = x + Math.random() * 3 - 1;
|
||||
event.targetY = y;
|
||||
|
||||
Reference in new issue
Block a user