mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 03:15:07 +00:00
Fix piston lens not working properly. Serverside some of the other lenses where safe
This commit is contained in:
1 parent
4e5cb59ebe
commit
dda3151b73
10 files changed
+24
-22
No files matched your search
@@ -24,6 +24,8 @@ public class LensDamage extends Lens {
|
||||
|
||||
@Override
|
||||
public void updateBurst(IManaBurst burst, EntityThrowable entity, ItemStack stack) {
|
||||
if (entity.worldObj.isRemote)
|
||||
return;
|
||||
AxisAlignedBB axis = new AxisAlignedBB(entity.posX, entity.posY, entity.posZ, entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ).expand(1, 1, 1);
|
||||
List<EntityLivingBase> entities = entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axis);
|
||||
for(EntityLivingBase living : entities) {
|
||||
@@ -34,7 +36,7 @@ public class LensDamage extends Lens {
|
||||
int mana = burst.getMana();
|
||||
if(mana >= 16) {
|
||||
burst.setMana(mana - 16);
|
||||
if(!burst.isFake() && !entity.worldObj.isRemote)
|
||||
if(!burst.isFake())
|
||||
living.attackEntityFrom(DamageSource.magic, 8);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ public class LensExplosive extends Lens {
|
||||
|
||||
@Override
|
||||
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
|
||||
if(!burst.isFake()) {
|
||||
if(!entity.worldObj.isRemote && !burst.isFake()) {
|
||||
BlockPos coords = burst.getBurstSourceBlockPos();
|
||||
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.getBlockPos() == null || !coords.equals(pos.getBlockPos())))
|
||||
if(pos.entityHit == null && !isManaBlock && (pos.getBlockPos() == null || !coords.equals(pos.getBlockPos())))
|
||||
entity.worldObj.createExplosion(entity, entity.posX, entity.posY, entity.posZ, burst.getMana() / 50F, true);
|
||||
} else dead = false;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileIncensePlate;
|
||||
|
||||
@@ -26,7 +27,7 @@ public class LensFire extends Lens {
|
||||
@Override
|
||||
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
|
||||
BlockPos coords = burst.getBurstSourceBlockPos();
|
||||
if(pos.getBlockPos() != null && !coords.equals(pos.getBlockPos()) && !burst.isFake() && !isManaBlock) {
|
||||
if(!entity.worldObj.isRemote && pos.getBlockPos() != null && !coords.equals(pos.getBlockPos()) && !burst.isFake() && !isManaBlock) {
|
||||
EnumFacing dir = pos.sideHit;
|
||||
|
||||
BlockPos pos_ = pos.getBlockPos().offset(dir);
|
||||
@@ -39,6 +40,7 @@ public class LensFire extends Lens {
|
||||
else if(blockAt == ModBlocks.incensePlate) {
|
||||
TileIncensePlate plate = (TileIncensePlate) entity.worldObj.getTileEntity(pos.getBlockPos());
|
||||
plate.ignite();
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(plate);
|
||||
} else if(blockAt_.isAir(entity.worldObj, pos_))
|
||||
entity.worldObj.setBlockState(pos_, Blocks.fire.getDefaultState());
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ public class LensFirework extends Lens {
|
||||
|
||||
@Override
|
||||
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
|
||||
if(!burst.isFake()) {
|
||||
if(!entity.worldObj.isRemote && !burst.isFake()) {
|
||||
BlockPos coords = burst.getBurstSourceBlockPos();
|
||||
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.getBlockPos() == null || !pos.getBlockPos().equals(coords))) {
|
||||
if(pos.entityHit == null && !isManaBlock && (pos.getBlockPos() == null || !pos.getBlockPos().equals(coords))) {
|
||||
ItemStack fireworkStack = generateFirework(burst.getColor());
|
||||
|
||||
EntityFireworkRocket rocket = new EntityFireworkRocket(entity.worldObj, entity.posX, entity.posY, entity.posZ, fireworkStack);
|
||||
|
||||
@@ -30,13 +30,13 @@ public class LensInfluence extends Lens {
|
||||
public void updateBurst(IManaBurst burst, EntityThrowable entity, ItemStack stack) {
|
||||
if(!burst.isFake()) {
|
||||
double range = 3.5;
|
||||
List movables = entity.worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range));
|
||||
List<Entity> movables = entity.worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range));
|
||||
movables.addAll(entity.worldObj.getEntitiesWithinAABB(EntityXPOrb.class, new AxisAlignedBB(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range)));
|
||||
movables.addAll(entity.worldObj.getEntitiesWithinAABB(EntityArrow.class, new AxisAlignedBB(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range)));
|
||||
movables.addAll(entity.worldObj.getEntitiesWithinAABB(EntityFallingBlock.class, new AxisAlignedBB(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range)));
|
||||
movables.addAll(entity.worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(entity.posX - range, entity.posY - range, entity.posZ - range, entity.posX + range, entity.posY + range, entity.posZ + range), Predicates.instanceOf(IManaBurst.class)));
|
||||
|
||||
for(Entity movable : ((List<Entity>) movables)) {
|
||||
for(Entity movable : movables) {
|
||||
if(movable == burst)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class LensMine extends Lens {
|
||||
World world = entity.worldObj;
|
||||
|
||||
BlockPos pos_ = pos.getBlockPos();
|
||||
if (pos_ == null)
|
||||
if (world.isRemote || pos_ == null)
|
||||
return false;
|
||||
|
||||
Block block = world.getBlockState(pos_).getBlock();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class LensPaint extends Lens {
|
||||
@Override
|
||||
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
|
||||
int storedColor = ItemLens.getStoredColor(stack);
|
||||
if(!burst.isFake() && storedColor > -1 && storedColor < 17) {
|
||||
if(!entity.worldObj.isRemote && !burst.isFake() && storedColor > -1 && storedColor < 17) {
|
||||
if(pos.entityHit != null && pos.entityHit instanceof EntitySheep) {
|
||||
int r = 20;
|
||||
EnumDyeColor sheepColor = ((EntitySheep) pos.entityHit).getFleeceColor();
|
||||
@@ -72,14 +72,13 @@ public class LensPaint extends Lens {
|
||||
IBlockState stateThere = entity.worldObj.getBlockState(coords);
|
||||
|
||||
if(stateThere.getValue(BotaniaAPI.paintableBlocks.get(block)) != placeColor) {
|
||||
if(!entity.worldObj.isRemote)
|
||||
entity.worldObj.setBlockState(coords, stateThere.withProperty(BotaniaAPI.paintableBlocks.get(block), placeColor), 2);
|
||||
entity.worldObj.setBlockState(coords, stateThere.withProperty(BotaniaAPI.paintableBlocks.get(block), placeColor), 2);
|
||||
int hex = placeColor.getMapColor().colorValue;
|
||||
int r = (hex & 0xFF0000) >> 16;
|
||||
int g = (hex & 0xFF00) >> 8;
|
||||
int b = (hex & 0xFF);
|
||||
for(int i = 0; i < 4; i++)
|
||||
Botania.proxy.sparkleFX(entity.worldObj, coords.getX() + (float) Math.random(), coords.getY() + (float) Math.random(), coords.getZ() + (float) Math.random(), r / 255F, g / 255F, b / 255F, 0.6F + (float) Math.random() * 0.3F, 5);
|
||||
Botania.proxy.sparkleFX(entity.worldObj, coords.getX() + (float) Math.random(), coords.getY() + (float) Math.random(), coords.getZ() + (float) Math.random(), r / 255F, g / 255F, b / 255F, 0.6F + (float) Math.random() * 0.3F, 5); // todo 1.8 noop right now due to serversiding
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ public class LensPiston extends Lens {
|
||||
@Override
|
||||
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
|
||||
BlockPos coords = burst.getBurstSourceBlockPos();
|
||||
if(pos.getBlockPos() != null && !coords.equals(pos.getBlockPos()) && !burst.isFake() && !isManaBlock && !entity.worldObj.isRemote) {
|
||||
BlockPos pos_ = pos.getBlockPos().offset(pos.sideHit);
|
||||
if(!entity.worldObj.isRemote && pos.getBlockPos() != null && !coords.equals(pos.getBlockPos()) && !burst.isFake() && !isManaBlock) {
|
||||
BlockPos pos_ = pos.getBlockPos().offset(pos.sideHit.getOpposite());
|
||||
|
||||
if(entity.worldObj.isAirBlock(pos_) || entity.worldObj.getBlockState(pos_).getBlock().isReplaceable(entity.worldObj, pos_)) {
|
||||
IBlockState state = entity.worldObj.getBlockState(pos_);
|
||||
TileEntity tile = entity.worldObj.getTileEntity(pos_);
|
||||
IBlockState state = entity.worldObj.getBlockState(pos.getBlockPos());
|
||||
TileEntity tile = entity.worldObj.getTileEntity(pos.getBlockPos());
|
||||
|
||||
if(state.getBlock().getMobilityFlag() == 0 && state.getBlock() != Blocks.obsidian && state.getBlock().getBlockHardness(entity.worldObj, pos_) >= 0 && tile == null) {
|
||||
entity.worldObj.destroyBlock(pos.getBlockPos(), false);
|
||||
|
||||
@@ -20,9 +20,9 @@ public class LensStorm extends Lens {
|
||||
|
||||
@Override
|
||||
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
|
||||
if(!burst.isFake()) {
|
||||
if(!entity.worldObj.isRemote && !burst.isFake()) {
|
||||
BlockPos coords = burst.getBurstSourceBlockPos();
|
||||
if(!entity.worldObj.isRemote && pos.entityHit == null && !isManaBlock && (pos.getBlockPos() == null || !coords.equals(pos.getBlockPos())))
|
||||
if(pos.entityHit == null && !isManaBlock && (pos.getBlockPos() == null || !coords.equals(pos.getBlockPos())))
|
||||
entity.worldObj.createExplosion(entity, entity.posX, entity.posY, entity.posZ, 5F, true);
|
||||
} else dead = false;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class LensWeight extends Lens {
|
||||
|
||||
@Override
|
||||
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
|
||||
if(!burst.isFake() && pos.getBlockPos() != null) {
|
||||
if(!entity.worldObj.isRemote && !burst.isFake() && pos.getBlockPos() != null) {
|
||||
int harvestLevel = ConfigHandler.harvestLevelWeight;
|
||||
|
||||
Block block = entity.worldObj.getBlockState(pos.getBlockPos()).getBlock();
|
||||
@@ -33,8 +33,7 @@ public class LensWeight extends Lens {
|
||||
|
||||
if(blockBelow.isAir(entity.worldObj, pos.getBlockPos().down()) && block.getBlockHardness(entity.worldObj, pos.getBlockPos()) != -1 && neededHarvestLevel <= harvestLevel && entity.worldObj.getTileEntity(pos.getBlockPos()) == null && block.canSilkHarvest(entity.worldObj, pos.getBlockPos(), entity.worldObj.getBlockState(pos.getBlockPos()), null)) {
|
||||
EntityFallingBlock falling = new EntityFallingBlock(entity.worldObj, pos.getBlockPos().getX() + 0.5, pos.getBlockPos().getY() + 0.5, pos.getBlockPos().getZ() + 0.5, state);
|
||||
if(!entity.worldObj.isRemote)
|
||||
entity.worldObj.spawnEntityInWorld(falling);
|
||||
entity.worldObj.spawnEntityInWorld(falling);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user