mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Some entities
This commit is contained in:
1 parent
3b8926c24b
commit
6fb9b0101e
19 files changed
+93
-103
No files matched your search
@@ -68,7 +68,7 @@ public final class CorporeaHelper {
|
||||
if(network != null)
|
||||
for(ICorporeaSpark otherSpark : network)
|
||||
if(otherSpark != null) {
|
||||
IInventory inv = otherSpark.getInventory();
|
||||
IInventory inv = otherSpark.getSparkInventory();
|
||||
if(inv != null)
|
||||
inventories.add(inv);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface ICorporeaSpark {
|
||||
/**
|
||||
* Gets the inventory this spark is bound to, generally the one right below it.
|
||||
*/
|
||||
public IInventory getInventory();
|
||||
public IInventory getSparkInventory();
|
||||
|
||||
/**
|
||||
* Gets the list of sparks this spark is connected to, see registerConnections(). This list
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class TileCorporeaInterceptor extends TileCorporeaBase implements ICorpor
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 | 2);
|
||||
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, getBlockType(), 2);
|
||||
|
||||
TileEntity requestor = (TileEntity) source.getInventory();
|
||||
TileEntity requestor = (TileEntity) source.getSparkInventory();
|
||||
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
||||
if(tile != null && tile instanceof TileCorporeaRetainer)
|
||||
|
||||
@@ -61,7 +61,7 @@ public class TileCorporeaRetainer extends TileMod {
|
||||
|
||||
ICorporeaSpark spark = CorporeaHelper.getSparkForBlock(worldObj, , requestX);
|
||||
if(spark != null) {
|
||||
IInventory inv = spark.getInventory();
|
||||
IInventory inv = spark.getSparkInventory();
|
||||
if(inv != null && inv instanceof ICorporeaRequestor) {
|
||||
ICorporeaRequestor requestor = (ICorporeaRequestor) inv;
|
||||
requestor.doCorporeaRequest(request, requestCount, spark);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ModBrews {
|
||||
waterBreathing = new BrewMod(LibBrewNames.WATER_BREATHING, 0x84A7CF, 4000, new PotionEffect(Potion.waterBreathing.id, 9600, 0));
|
||||
invisibility = new BrewMod(LibBrewNames.INVISIBILITY, 0xAEAEAE, 8000, new PotionEffect(Potion.invisibility.id, 9600, 0));
|
||||
nightVision = new BrewMod(LibBrewNames.NIGHT_VISION, 0x7C4BEB, 4000, new PotionEffect(Potion.nightVision.id, 9600, 0));
|
||||
absorption = new BrewMod(LibBrewNames.ABSORPTION, 0xF2EB23, 7000, new PotionEffect(Potion.field_76444_x.id, 1800, 3)).setNotBloodPendantInfusable().setNotIncenseInfusable();
|
||||
absorption = new BrewMod(LibBrewNames.ABSORPTION, 0xF2EB23, 7000, new PotionEffect(Potion.absorption.id, 1800, 3)).setNotBloodPendantInfusable().setNotIncenseInfusable();
|
||||
|
||||
overload = new BrewMod(LibBrewNames.OVERLOAD, 0x232323, 12000, new PotionEffect(Potion.damageBoost.id, 1800, 3), new PotionEffect(Potion.moveSpeed.id, 1800, 2), new PotionEffect(Potion.weakness.id, 2400, 2), new PotionEffect(Potion.hunger.id, 200, 2));
|
||||
soulCross = new BrewModPotion(LibBrewNames.SOUL_CROSS, 10000, new PotionEffect(ModPotions.soulCross.id, 1800, 0));
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.brew.potion;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -28,8 +29,8 @@ public class PotionClear extends PotionMod {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void affectEntity(EntityLivingBase e, EntityLivingBase e1, int t, double d) {
|
||||
e1.curePotionEffects(new ItemStack(Items.milk_bucket));
|
||||
public void affectEntity(Entity e, Entity e1, EntityLivingBase e2, int t, double d) {
|
||||
e2.curePotionEffects(new ItemStack(Items.milk_bucket));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class PotionMod extends Potion {
|
||||
private static final ResourceLocation resource = new ResourceLocation(LibResources.GUI_POTIONS);
|
||||
|
||||
public PotionMod(int id, String name, boolean badEffect, int color, int iconIndex) {
|
||||
super(id, badEffect, color);
|
||||
super(id, new ResourceLocation("botania", name), badEffect, color);
|
||||
setPotionName("botania.potion." + name);
|
||||
setIconIndex(iconIndex % 8, iconIndex / 8);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
|
||||
MovingObjectPosition lookat = ToolCommons.raytraceFromEntity(worldObj, player, true, 64);
|
||||
if(lookat == null)
|
||||
playerLook = new Vector3(player.getLookVec()).multiply(64).add(Vector3.fromEntity(player));
|
||||
else playerLook = new Vector3(lookat.blockX + 0.5, lookat.blockY + 0.5, lookat.blockZ + 0.5);
|
||||
else playerLook = new Vector3(lookat.getBlockPos().getX() + 0.5, lookat.getBlockPos().getY() + 0.5, lookat.getBlockPos().getZ() + 0.5);
|
||||
|
||||
Vector3 thisVec = Vector3.fromEntityCenter(this);
|
||||
Vector3 motionVec = playerLook.sub(thisVec).normalize().multiply(2);
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.corporea.ICorporeaSpark;
|
||||
@@ -67,7 +68,7 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
IInventory inv = getInventory();
|
||||
IInventory inv = getSparkInventory();
|
||||
if(inv == null) {
|
||||
if(!worldObj.isRemote)
|
||||
setDead();
|
||||
@@ -177,11 +178,11 @@ public class EntityCorporeaSpark extends Entity implements ICorporeaSpark {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
public IInventory getSparkInventory() {
|
||||
int x = MathHelper.floor_double(posX);
|
||||
int y = MathHelper.floor_double(posY - 1);
|
||||
int z = MathHelper.floor_double(posZ);
|
||||
return InventoryHelper.getInventory(worldObj, , x);
|
||||
return InventoryHelper.getInventory(worldObj, new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,14 +41,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
@@ -142,7 +135,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
public static boolean spawn(EntityPlayer player, ItemStack par1ItemStack, World par3World, int par4, int par5, int par6, boolean hard) {
|
||||
Block block = par3World.getBlock(par4, par5, par6);
|
||||
if(block == Blocks.beacon && isTruePlayer(player) && !par3World.isRemote) {
|
||||
if(par3World.difficultySetting == EnumDifficulty.PEACEFUL) {
|
||||
if(par3World.getDifficulty() == EnumDifficulty.PEACEFUL) {
|
||||
player.addChatMessage(new ChatComponentTranslation("botaniamisc.peacefulNoob").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
|
||||
return false;
|
||||
}
|
||||
@@ -405,7 +398,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
}
|
||||
|
||||
worldObj.playSoundAtEntity(this, "random.explode", 20F, (1F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
worldObj.spawnParticle("hugeexplosion", posX, posY, posZ, 1D, 0D, 0D);
|
||||
worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, posX, posY, posZ, 1D, 0D, 0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -475,7 +468,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
@Override
|
||||
public void setDead() {
|
||||
BlockPos source = getSource();
|
||||
Botania.proxy.playRecordClientSided(worldObj, , source.posX, null);
|
||||
Botania.proxy.playRecordClientSided(worldObj, source, null);
|
||||
isPlayingMusic = false;
|
||||
super.setDead();
|
||||
}
|
||||
@@ -497,7 +490,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
|
||||
ridingEntity = null;
|
||||
}
|
||||
|
||||
boolean peaceful = worldObj.difficultySetting == EnumDifficulty.PEACEFUL;
|
||||
boolean peaceful = worldObj.getDifficulty() == EnumDifficulty.PEACEFUL;
|
||||
if(!worldObj.isRemote && peaceful)
|
||||
setDead();
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.pattern.BlockHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -34,34 +35,29 @@ public class EntityEnderAirBottle extends EntityThrowable {
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition pos) {
|
||||
if(pos.entityHit == null && !worldObj.isRemote) {
|
||||
List<BlockPos> coordsList = getCoordsToPut(pos.blockX, pos.blockY, pos.blockZ);
|
||||
worldObj.playAuxSFX(2002, (int)Math.round(posX), (int)Math.round(posY), (int)Math.round(posZ), 8);
|
||||
List<BlockPos> coordsList = getCoordsToPut(pos.getBlockPos());
|
||||
worldObj.playAuxSFX(2002, new BlockPos((int)Math.round(posX), (int)Math.round(posY), (int)Math.round(posZ)), 8);
|
||||
|
||||
for(BlockPos coords : coordsList) {
|
||||
worldObj.setBlock(coords.posX, coords.posY, coords.posZ, Blocks.end_stone);
|
||||
worldObj.setBlockState(coords, Blocks.end_stone.getDefaultState());
|
||||
if(Math.random() < 0.1)
|
||||
worldObj.playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(Blocks.end_stone));
|
||||
worldObj.playAuxSFX(2001, coords, Block.getIdFromBlock(Blocks.end_stone));
|
||||
}
|
||||
setDead();
|
||||
}
|
||||
}
|
||||
|
||||
public List<BlockPos> getCoordsToPut(int xCoord, int yCoord, int zCoord) {
|
||||
public List<BlockPos> getCoordsToPut(BlockPos pos) {
|
||||
List<BlockPos> possibleCoords = new ArrayList();
|
||||
List<BlockPos> selectedCoords = new ArrayList();
|
||||
int range = 4;
|
||||
int rangeY = 4;
|
||||
|
||||
for(int i = -range; i < range + 1; i++)
|
||||
for(int j = -rangeY; j < rangeY; j++)
|
||||
for(int k = -range; k < range + 1; k++) {
|
||||
int x = xCoord + i;
|
||||
int y = yCoord + j;
|
||||
int z = zCoord + k;
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
if(block != null && block.isReplaceableOreGen(worldObj, x, y, z, Blocks.stone))
|
||||
possibleCoords.add(new BlockPos(x, y, z));
|
||||
}
|
||||
for (BlockPos bPos : ((Iterable<BlockPos>) BlockPos.getAllInBox(pos.add(-range, -rangeY, -range), pos.add(range, rangeY, range)))) {
|
||||
Block block = worldObj.getBlockState(pos).getBlock();
|
||||
if(block != null && block.isReplaceableOreGen(worldObj, pos, BlockHelper.forBlock(Blocks.stone)))
|
||||
possibleCoords.add(pos);
|
||||
}
|
||||
|
||||
int count = 64;
|
||||
while(!possibleCoords.isEmpty() && count > 0) {
|
||||
|
||||
@@ -74,9 +74,9 @@ public class EntityFallingStar extends EntityThrowableCopy {
|
||||
else pos.entityHit.attackEntityFrom(DamageSource.generic, 10);
|
||||
}
|
||||
|
||||
Block block = worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
if(ConfigHandler.blockBreakParticles && !block.isAir(worldObj, pos.blockX, pos.blockY, pos.blockZ))
|
||||
worldObj.playAuxSFX(2001, pos.blockX, pos.blockY, pos.blockZ, Block.getIdFromBlock(block) + (worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) << 12));
|
||||
Block block = worldObj.getBlockState(pos.getBlockPos()).getBlock();
|
||||
if(ConfigHandler.blockBreakParticles && !block.isAir(worldObj, pos.getBlockPos()))
|
||||
worldObj.playAuxSFX(2001, pos.getBlockPos(), Block.getStateId(worldObj.getBlockState(pos.getBlockPos())));
|
||||
|
||||
setDead();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.common.entity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.passive.EntityAmbientCreature;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -22,12 +23,12 @@ public class EntityFlyingCreature extends EntityAmbientCreature {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fall(float par1) {
|
||||
public void fall(float dist, float damageMult) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateFallState(double par1, boolean par3) {
|
||||
protected void updateFallState(double y, boolean onGround, Block block, BlockPos pos) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@@ -50,7 +51,7 @@ public class EntityFlyingCreature extends EntityAmbientCreature {
|
||||
|
||||
if (onGround) {
|
||||
f2 = 0.54600006F;
|
||||
Block block = worldObj.getBlock(MathHelper.floor_double(posX), MathHelper.floor_double(boundingBox.minY) - 1, MathHelper.floor_double(posZ));
|
||||
Block block = worldObj.getBlockState(new BlockPos(MathHelper.floor_double(posX), MathHelper.floor_double(getEntityBoundingBox().minY) - 1, MathHelper.floor_double(posZ))).getBlock();
|
||||
f2 = block.slipperiness * 0.91F;
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ public class EntityFlyingCreature extends EntityAmbientCreature {
|
||||
|
||||
if (onGround) {
|
||||
f2 = 0.54600006F;
|
||||
Block block = worldObj.getBlock(MathHelper.floor_double(posX), MathHelper.floor_double(boundingBox.minY) - 1, MathHelper.floor_double(posZ));
|
||||
Block block = worldObj.getBlockState(new BlockPos(MathHelper.floor_double(posX), MathHelper.floor_double(getEntityBoundingBox().minY) - 1, MathHelper.floor_double(posZ))).getBlock();
|
||||
f2 = block.slipperiness * 0.91F;
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public class EntityMagicMissile extends EntityThrowable {
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition pos) {
|
||||
Block block = worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
|
||||
Block block = worldObj.getBlockState(pos.getBlockPos()).getBlock();
|
||||
|
||||
if(!(block instanceof BlockBush) && !(block instanceof BlockLeaves) && (pos.entityHit == null || getTargetEntity() == pos.entityHit))
|
||||
setDead();
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.UUID;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -103,7 +104,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
|
||||
this.fake = fake;
|
||||
|
||||
setBurstSourceCoords(tile.xCoord);
|
||||
setBurstSourceCoords(tile.getPos());
|
||||
setLocationAndAngles(tile.xCoord + 0.5, tile.yCoord + 0.5, tile.zCoord + 0.5, 0, 0);
|
||||
rotationYaw = -(spreader.getRotationX() + 90F);
|
||||
rotationPitch = spreader.getRotationY();
|
||||
@@ -126,7 +127,6 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
posZ -= MathHelper.sin((rotationYaw + 180) / 180.0F * (float) Math.PI) * 0.16F;
|
||||
|
||||
setPosition(posX, posY, posZ);
|
||||
yOffset = 0.0F;
|
||||
float f = 0.4F;
|
||||
double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D;
|
||||
double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
|
||||
@@ -166,7 +166,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
|
||||
if(entity1.canBeCollidedWith() && (entity1 != entitylivingbase || ticksInAir >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
|
||||
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f, f, f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
|
||||
|
||||
if(movingobjectposition1 != null) {
|
||||
@@ -429,9 +429,9 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
par1nbtTagCompound.setTag(TAG_LENS_STACK, lensCmp);
|
||||
|
||||
BlockPos coords = getBurstSourceBlockPos();
|
||||
par1nbtTagCompound.setInteger(TAG_SPREADER_X, coords.posX);
|
||||
par1nbtTagCompound.setInteger(TAG_SPREADER_Y, coords.posY);
|
||||
par1nbtTagCompound.setInteger(TAG_SPREADER_Z, coords.posZ);
|
||||
par1nbtTagCompound.setInteger(TAG_SPREADER_X, coords.getX());
|
||||
par1nbtTagCompound.setInteger(TAG_SPREADER_Y, coords.getY());
|
||||
par1nbtTagCompound.setInteger(TAG_SPREADER_Z, coords.getZ());
|
||||
|
||||
par1nbtTagCompound.setDouble(TAG_LAST_MOTION_X, motionX);
|
||||
par1nbtTagCompound.setDouble(TAG_LAST_MOTION_Y, motionY);
|
||||
@@ -626,7 +626,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
}
|
||||
}
|
||||
|
||||
protected void onRecieverImpact(IManaReceiver tile, int x, int y, int z) {
|
||||
protected void onRecieverImpact(IManaReceiver tile, BlockPos pos) {
|
||||
int mana = getMana();
|
||||
if(tile instanceof IManaCollector)
|
||||
mana *= ((IManaCollector) tile).getManaYieldMultiplier(this);
|
||||
@@ -634,7 +634,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
tile.recieveMana(mana);
|
||||
if(tile instanceof IThrottledPacket)
|
||||
((IThrottledPacket) tile).markDispatchable();
|
||||
else VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, , x);
|
||||
else VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -649,9 +649,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
}
|
||||
|
||||
public TileEntity getShooter() {
|
||||
BlockPos coords = getBurstSourceBlockPos();
|
||||
TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
|
||||
return tile;
|
||||
return worldObj.getTileEntity(getBurstSourceBlockPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -794,8 +792,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
|
||||
@Override
|
||||
public void setCollidedAt(BlockPos pos) {
|
||||
if(!hasAlreadyCollidedAt(x))
|
||||
alreadyCollidedAt.add(getCollisionLocString(x, y, z));
|
||||
if(!hasAlreadyCollidedAt(pos))
|
||||
alreadyCollidedAt.add(getCollisionLocString(pos));
|
||||
}
|
||||
|
||||
private String getCollisionLocString(int x, int y, int z) {
|
||||
@@ -841,7 +839,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
|
||||
public void setDeathTicksForFakeParticle() {
|
||||
BlockPos coords = getBurstSourceBlockPos();
|
||||
TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
|
||||
TileEntity tile = worldObj.getTileEntity(coords);
|
||||
if(tile != null && tile instanceof IManaSpreader)
|
||||
((IManaSpreader) tile).setLastBurstDeathTick(getTicksExisted());
|
||||
}
|
||||
@@ -849,8 +847,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
public static class PositionProperties {
|
||||
|
||||
public final BlockPos coords;
|
||||
public final Block block;
|
||||
public final int meta;
|
||||
public final IBlockState state;
|
||||
|
||||
public boolean invalid = false;
|
||||
|
||||
@@ -859,8 +856,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
int y = MathHelper.floor_double(entity.posY);
|
||||
int z = MathHelper.floor_double(entity.posZ);
|
||||
coords = new BlockPos(x, y, z);
|
||||
block = entity.worldObj.getBlock(x, y, z);
|
||||
meta = entity.worldObj.getBlockMetadata(x, y, z);
|
||||
state = entity.worldObj.getBlockState(coords);
|
||||
}
|
||||
|
||||
public boolean coordsEqual(PositionProperties props) {
|
||||
@@ -868,14 +864,12 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
}
|
||||
|
||||
public boolean contentsEqual(World world) {
|
||||
if(!world.blockExists(coords.posX, coords.posY, coords.posZ)) {
|
||||
if(!world.isBlockLoaded(coords)) {
|
||||
invalid = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
Block block = world.getBlock(coords.posX , coords.posY, coords.posZ);
|
||||
int meta = world.getBlockMetadata(coords.posX, coords.posY, coords.posZ);
|
||||
return block == this.block && meta == this.meta;
|
||||
return world.getBlockState(coords) == this.state;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,15 @@
|
||||
package vazkii.botania.common.entity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
@@ -47,8 +50,8 @@ public class EntityPoolMinecart extends EntityMinecart {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block func_145817_o() {
|
||||
return ModBlocks.pool;
|
||||
public IBlockState getDisplayTile() {
|
||||
return ModBlocks.pool.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,14 +60,14 @@ public class EntityPoolMinecart extends EntityMinecart {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinecartType() {
|
||||
return 0;
|
||||
public EnumMinecartType getMinecartType() {
|
||||
return EnumMinecartType.RIDEABLE; // todo 1.8
|
||||
}
|
||||
|
||||
@Override
|
||||
public void killMinecart(DamageSource p_94095_1_) {
|
||||
super.killMinecart(p_94095_1_);
|
||||
func_145778_a(Item.getItemFromBlock(ModBlocks.pool), 1, 0.0F);
|
||||
dropItemWithOffset(Item.getItemFromBlock(ModBlocks.pool), 1, 0.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,24 +76,21 @@ public class EntityPoolMinecart extends EntityMinecart {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveMinecartOnRail(int x, int y, int z, double par4) {
|
||||
super.moveMinecartOnRail(x, y, z, par4);
|
||||
public void moveMinecartOnRail(BlockPos pos) {
|
||||
super.moveMinecartOnRail(pos);
|
||||
|
||||
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
int xp = x + dir.offsetX;
|
||||
int zp = z + dir.offsetZ;
|
||||
Block block = worldObj.getBlock(xp, y, zp);
|
||||
for(EnumFacing dir : LibMisc.CARDINAL_DIRECTIONS) {
|
||||
BlockPos posP = pos.offset(dir);
|
||||
Block block = worldObj.getBlockState(posP).getBlock();
|
||||
if(block == ModBlocks.pump) {
|
||||
int xp_ = xp + dir.offsetX;
|
||||
int zp_ = zp + dir.offsetZ;
|
||||
int meta = worldObj.getBlockMetadata(xp, y, zp);
|
||||
TileEntity tile = worldObj.getTileEntity(xp_, y, zp_);
|
||||
TileEntity tile_ = worldObj.getTileEntity(xp, y, zp);
|
||||
BlockPos posP_ = posP.offset(dir);
|
||||
TileEntity tile = worldObj.getTileEntity(posP_);
|
||||
TileEntity tile_ = worldObj.getTileEntity(posP);
|
||||
TilePump pump = (TilePump) tile_;
|
||||
|
||||
if(tile != null && tile instanceof IManaPool && !pump.hasRedstone) {
|
||||
IManaPool pool = (IManaPool) tile;
|
||||
ForgeDirection pumpDir = ForgeDirection.getOrientation(meta);
|
||||
EnumFacing pumpDir = ForgeDirection.getOrientation(meta);
|
||||
boolean did = false;
|
||||
boolean can = false;
|
||||
|
||||
@@ -119,7 +119,7 @@ public class EntityPoolMinecart extends EntityMinecart {
|
||||
}
|
||||
|
||||
if(did) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, , xp_);
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, posP_);
|
||||
pump.hasCart = true;
|
||||
if(!pump.active)
|
||||
pump.setActive(true);
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.common.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.Botania;
|
||||
@@ -44,14 +45,17 @@ public class EntitySignalFlare extends Entity {
|
||||
|
||||
int color = getColor();
|
||||
if(color < 16 && color >= 0) {
|
||||
float[] colorArray = EntitySheep.fleeceColorTable[color];
|
||||
int hex = EnumDyeColor.byMetadata(color).getMapColor().colorValue;
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = (hex & 0xFF);
|
||||
|
||||
Botania.proxy.setWispFXDistanceLimit(false);
|
||||
for(int i = 0; i < 3; i++)
|
||||
Botania.proxy.wispFX(worldObj, posX, posY, posZ + 0.5, colorArray[0], colorArray[1], colorArray[2], (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F));
|
||||
Botania.proxy.wispFX(worldObj, posX, posY, posZ + 0.5, r, g, b, (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F));
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
Botania.proxy.wispFX(worldObj, posX + 0.5, 256, posZ + 0.5, colorArray[0], colorArray[1], colorArray[2], (float) Math.random() * 15 + 8F, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
|
||||
Botania.proxy.wispFX(worldObj, posX + 0.5, 256, posZ + 0.5, r, g, b, (float) Math.random() * 15 + 8F, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
|
||||
Botania.proxy.setWispFXDistanceLimit(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
@@ -306,7 +307,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
|
||||
int x = MathHelper.floor_double(posX);
|
||||
int y = MathHelper.floor_double(posY) - 1;
|
||||
int z = MathHelper.floor_double(posZ);
|
||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
||||
TileEntity tile = worldObj.getTileEntity(new BlockPos(x, y, z));
|
||||
if(tile != null && tile instanceof ISparkAttachable)
|
||||
return (ISparkAttachable) tile;
|
||||
|
||||
|
||||
@@ -13,9 +13,10 @@ package vazkii.botania.common.entity;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
|
||||
public class EntityVineBall extends EntityThrowable {
|
||||
@@ -35,22 +36,20 @@ public class EntityVineBall extends EntityThrowable {
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition var1) {
|
||||
if(var1 != null) {
|
||||
int meta = var1.sideHit;
|
||||
int meta = var1.sideHit.getIndex();
|
||||
int[] metaPlace = new int[] {
|
||||
1, 4, 8, 2
|
||||
};
|
||||
|
||||
if(meta > 1 && meta < 6) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta);
|
||||
int x = var1.blockX + dir.offsetX;
|
||||
int y = var1.blockY + dir.offsetY;
|
||||
int z = var1.blockZ + dir.offsetZ;
|
||||
while(y > 0) {
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
if(block.isAir(worldObj, x, y, z)) {
|
||||
worldObj.setBlock(x, y, z, ModBlocks.solidVines, metaPlace[meta - 2], 1 | 2);
|
||||
worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(ModBlocks.solidVines) + (metaPlace[meta - 2] << 12));
|
||||
y--;
|
||||
EnumFacing dir = EnumFacing.getFront(meta);
|
||||
BlockPos pos = var1.getBlockPos().offset(dir);
|
||||
while(pos.getY() > 0) {
|
||||
Block block = worldObj.getBlockState(pos).getBlock();
|
||||
if(block.isAir(worldObj, pos)) {
|
||||
worldObj.setBlockState(pos, ModBlocks.solidVines, metaPlace[meta - 2], 1 | 2);
|
||||
worldObj.playAuxSFX(2001, pos, Block.getIdFromBlock(ModBlocks.solidVines) + (metaPlace[meta - 2] << 12)); // todo 1.8 to state id?
|
||||
pos = pos.down();
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user