minimize client world class

This commit is contained in:
Sen 2025-07-23 13:19:32 +02:00
parent eec61c9258
commit 76e018b4ed
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
62 changed files with 1183 additions and 1338 deletions

View file

@ -54,7 +54,6 @@ import common.vars.Vars;
import common.world.Explosion;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
@ -845,7 +844,7 @@ public class Block {
public void tick(AWorldServer world, BlockPos pos, State state, Random rand) {
}
public void displayTick(AWorldClient world, BlockPos pos, State state, Random rand) {
public void displayTick(World world, BlockPos pos, State state, Random rand) {
}
public void onStartBreak(World world, BlockPos pos, EntityNPC player) {
@ -896,7 +895,7 @@ public class Block {
return false;
}
public void onUpdate(World world, BlockPos pos, State state, Block neighbor) {
public void onUpdate(AWorldServer world, BlockPos pos, State state, Block neighbor) {
}
public void onAdded(AWorldServer world, BlockPos pos, State state) {

View file

@ -26,7 +26,7 @@ public class BlockFalling extends Block {
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
}
public void onUpdate(World world, BlockPos pos, State state, Block neighbor) {
public void onUpdate(AWorldServer world, BlockPos pos, State state, Block neighbor) {
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
}

View file

@ -22,6 +22,7 @@ import common.util.ExtMath;
import common.util.Facing;
import common.util.Identifyable;
import common.util.WorldPos;
import common.world.AWorldServer;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
@ -102,7 +103,7 @@ public class BlockBed extends Block implements Rotatable {
this.setBedBounds();
}
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) {
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) {
Facing enumfacing = (Facing)state.getValue(FACING);
if(state.getValue(PART) == BlockBed.EnumPartType.HEAD) {
if(worldIn.getState(pos.offset(enumfacing.getOpposite())).getBlock() != this)

View file

@ -13,6 +13,7 @@ import common.rng.Random;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.world.AWorldServer;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
@ -162,7 +163,7 @@ public class BlockCake extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!this.canBlockStay(worldIn, pos))
{

View file

@ -9,6 +9,7 @@ import common.model.ModelProvider;
import common.model.GuiPosition;
import common.util.BlockPos;
import common.util.Facing;
import common.world.AWorldServer;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
@ -71,7 +72,7 @@ public class BlockCarpet extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
this.checkForDrop(worldIn, pos, state);
}

View file

@ -28,6 +28,7 @@ import common.util.Facing;
import common.util.HitPosition;
import common.util.Identifyable;
import common.util.Vec3;
import common.world.AWorldServer;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
import common.world.State;
@ -192,7 +193,7 @@ public class BlockDoor extends Block implements Rotatable {
}
}
public void onUpdate(World world, BlockPos pos, State state, Block neighbor) {
public void onUpdate(AWorldServer world, BlockPos pos, State state, Block neighbor) {
if(state.getValue(HALF) == EnumDoorHalf.UPPER) {
BlockPos lower = pos.down();
State bottom = world.getState(lower);
@ -358,9 +359,9 @@ public class BlockDoor extends Block implements Rotatable {
State iblockstate = door.getState().withProperty(BlockDoor.FACING, facing).withProperty(BlockDoor.HINGE, flag2 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT);
worldIn.setState(pos, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2);
worldIn.setState(blockpos2, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2);
if(update) {
worldIn.notifyNeighborsOfStateChange(pos, door);
worldIn.notifyNeighborsOfStateChange(blockpos2, door);
if(update && !worldIn.client) {
((AWorldServer)worldIn).notifyNeighborsOfStateChange(pos, door);
((AWorldServer)worldIn).notifyNeighborsOfStateChange(blockpos2, door);
}
}
}

View file

@ -93,7 +93,7 @@ public class BlockDragonEgg extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos));
}

View file

@ -18,7 +18,6 @@ import common.util.Facing;
import common.util.ParticleType;
import common.util.PortalType;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
@ -92,7 +91,7 @@ public class BlockFloorPortal extends Block
entityIn.setPortal(PortalType.FLOOR);
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
double d0 = (double)((float)pos.getX() + rand.floatv());
double d1 = (double)((float)pos.getY() + 0.8F);

View file

@ -177,7 +177,7 @@ public class BlockFlowerPot extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!worldIn.isBlockSolid(pos.down()))
{

View file

@ -14,6 +14,7 @@ import common.properties.Property;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.world.AWorldServer;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
@ -113,7 +114,7 @@ public class BlockLadder extends Block implements Rotatable
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
Facing enumfacing = (Facing)state.getValue(FACING);

View file

@ -22,8 +22,8 @@ import common.util.BoundingBox;
import common.util.Facing;
import common.util.ParticleType;
import common.util.PortalType;
import common.world.AWorldServer;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
@ -147,7 +147,7 @@ public class BlockPortal extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
Facing.Axis enumfacing$axis = (Facing.Axis)state.getValue(AXIS);
@ -224,7 +224,7 @@ public class BlockPortal extends Block
}
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
// if (rand.chance(100))
// {

View file

@ -28,7 +28,6 @@ import common.util.Vec3;
import common.world.Explosion;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
@ -561,7 +560,7 @@ public class BlockStairs extends Block implements Rotatable
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
this.base.displayTick(worldIn, pos, state, rand);
}

View file

@ -44,7 +44,7 @@ public class BlockBush extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
super.onUpdate(worldIn, pos, state, neighborBlock);
this.checkAndDropBlock(worldIn, pos, state);

View file

@ -109,7 +109,7 @@ public class BlockCactus extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!this.canBlockStay(worldIn, pos))
{

View file

@ -113,7 +113,7 @@ public class BlockFarmland extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
super.onUpdate(worldIn, pos, state, neighborBlock);

View file

@ -15,8 +15,8 @@ import common.util.BlockPos;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
public class BlockMycelium extends Block
@ -70,7 +70,7 @@ public class BlockMycelium extends Block
// }
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
super.displayTick(worldIn, pos, state, rand);

View file

@ -99,7 +99,7 @@ public class BlockReed extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
this.checkForDrop(worldIn, pos, state);
}

View file

@ -214,7 +214,7 @@ public class BlockVine extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!worldIn.client && !this.recheckGrownSides(worldIn, pos, state))
{

View file

@ -23,7 +23,6 @@ import common.util.Vec3;
import common.vars.Vars;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
@ -237,7 +236,7 @@ public abstract class BlockLiquid extends Block
return this.opaque ? BlockLayer.SOLID : BlockLayer.TRANSLUCENT;
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
double d0 = (double)pos.getX();
double d1 = (double)pos.getY();
@ -288,7 +287,7 @@ public abstract class BlockLiquid extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
this.checkForMixing(worldIn, pos, state);
}

View file

@ -34,7 +34,7 @@ public class BlockStaticLiquid extends BlockLiquid
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!this.checkForMixing(worldIn, pos, state))
{
@ -42,7 +42,7 @@ public class BlockStaticLiquid extends BlockLiquid
}
}
private void updateLiquid(World worldIn, BlockPos pos, State state)
private void updateLiquid(AWorldServer worldIn, BlockPos pos, State state)
{
worldIn.setState(pos, this.dynamicBlock.getState().withProperty(LEVEL, state.getValue(LEVEL)), 2);
worldIn.scheduleUpdate(pos, this.dynamicBlock, this.tickRate(worldIn, pos));

View file

@ -5,15 +5,15 @@ import common.block.Material;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
public class BlockBedrock extends Block {
public BlockBedrock() {
super(Material.SOLID);
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
if(/* worldIn.canShowVoidParticles() && */ pos.getY() <= 5 && rand.chance(8)) {
worldIn.spawnParticle(ParticleType.DEPTH, (double)pos.getX() + rand.floatv(), (double)(pos.getY()+1) + (rand.floatv() * 0.5f),

View file

@ -25,7 +25,6 @@ import common.util.PortalType;
import common.vars.Vars;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
@ -322,7 +321,7 @@ public class BlockFire extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!worldIn.isBlockSolid(pos.down()) && !this.canNeighborCatchFire(worldIn, pos))
{
@ -346,7 +345,7 @@ public class BlockFire extends Block
}
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
if (rand.chance(24))
{

View file

@ -88,7 +88,7 @@ public class BlockSnow extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
this.checkAndDropBlock(worldIn, pos, state);
}

View file

@ -94,7 +94,7 @@ public abstract class BlockBasePressurePlate extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!this.canBePlacedOn(worldIn, pos.down()))
{
@ -132,7 +132,7 @@ public abstract class BlockBasePressurePlate extends Block
if (i == 0)
{
this.updateState(worldIn, pos, state, i);
this.updateState((AWorldServer)worldIn, pos, state, i);
}
}
}
@ -140,7 +140,7 @@ public abstract class BlockBasePressurePlate extends Block
/**
* Updates the pressure plate when stepped on
*/
protected void updateState(World worldIn, BlockPos pos, State state, int oldSignal)
protected void updateState(AWorldServer worldIn, BlockPos pos, State state, int oldSignal)
{
int i = this.computeSignalStrength(worldIn, pos);
boolean flag = oldSignal > 0;
@ -191,7 +191,7 @@ public abstract class BlockBasePressurePlate extends Block
/**
* Notify block and block below of changes
*/
protected void updateNeighbors(World worldIn, BlockPos pos)
protected void updateNeighbors(AWorldServer worldIn, BlockPos pos)
{
worldIn.notifyNeighborsOfStateChange(pos, this);
worldIn.notifyNeighborsOfStateChange(pos.down(), this);

View file

@ -20,7 +20,6 @@ import common.util.BlockPos;
import common.util.BoundingBox;
import common.util.Facing;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
@ -415,7 +414,7 @@ public class BlockBrewingStand extends Block implements ITileEntityProvider
}
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
double d0 = (double)((float)pos.getX() + 0.4F + rand.floatv() * 0.2F);
double d1 = (double)((float)pos.getY() + 0.7F + rand.floatv() * 0.3F);

View file

@ -113,7 +113,7 @@ public class BlockButton extends Block implements Directional
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (this.checkForDrop(worldIn, pos, state) && !canPlaceButtonOn(worldIn, pos, ((Facing)state.getValue(FACING)).getOpposite()))
{
@ -189,8 +189,10 @@ public class BlockButton extends Block implements Directional
worldIn.setState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 3);
worldIn.markBlockRangeForRenderUpdate(pos, pos);
worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F);
this.notifyNeighbors(worldIn, pos, (Facing)state.getValue(FACING));
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, null));
if(!worldIn.client) {
this.notifyNeighbors((AWorldServer)worldIn, pos, (Facing)state.getValue(FACING));
((AWorldServer)worldIn).scheduleUpdate(pos, this, this.tickRate(worldIn, null));
}
return true;
}
}
@ -249,13 +251,13 @@ public class BlockButton extends Block implements Directional
{
if (!((Boolean)state.getValue(POWERED)).booleanValue())
{
this.checkForArrows(worldIn, pos, state);
this.checkForArrows((AWorldServer)worldIn, pos, state);
}
}
}
}
private void checkForArrows(World worldIn, BlockPos pos, State state)
private void checkForArrows(AWorldServer worldIn, BlockPos pos, State state)
{
this.updateBlockBounds(state);
List <? extends Entity > list = worldIn.<Entity>getEntitiesWithinAABB(EntityArrow.class, new BoundingBox((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ));
@ -284,7 +286,7 @@ public class BlockButton extends Block implements Directional
}
}
private void notifyNeighbors(World worldIn, BlockPos pos, Facing facing)
private void notifyNeighbors(AWorldServer worldIn, BlockPos pos, Facing facing)
{
worldIn.notifyNeighborsOfStateChange(pos, this);
worldIn.notifyNeighborsOfStateChange(pos.offset(facing.getOpposite()), this);

View file

@ -20,7 +20,6 @@ import common.tileentity.TileEntityFurnace;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
@ -74,7 +73,7 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
if (this.isBurning)
{

View file

@ -143,7 +143,7 @@ public class BlockLever extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (this.checkDrop(worldIn, pos, state) && !canPlaceLeverOn(worldIn, pos, ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite()))
{
@ -212,9 +212,9 @@ public class BlockLever extends Block
state = state.cycleProperty(POWERED);
worldIn.setState(pos, state, 3);
worldIn.playSound(SoundEvent.CLICK, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 0.3F);
worldIn.notifyNeighborsOfStateChange(pos, this);
((AWorldServer)worldIn).notifyNeighborsOfStateChange(pos, this);
Facing enumfacing = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing();
worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this);
((AWorldServer)worldIn).notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this);
return true;
}
}

View file

@ -12,7 +12,6 @@ import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.vars.Vars;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
import common.world.AWorldServer;
@ -54,7 +53,7 @@ public class BlockLitTorch extends BlockTorch {
}
}
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) {
public void displayTick(World worldIn, BlockPos pos, State state, Random rand) {
if(this.unlit.getParticleColor() == 0xffffffff) {
Facing enumfacing = (Facing)state.getValue(FACING);
double d0 = (double)pos.getX() + 0.5D;

View file

@ -44,7 +44,7 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti
return true;
}
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) {
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) {
this.updateState(worldIn, pos, state);
}

View file

@ -33,14 +33,14 @@ public class BlockPistonBase extends Block implements Directional
{
private static class BlockPistonStructureHelper
{
private final World world;
private final AWorldServer world;
private final BlockPos pistonPos;
private final BlockPos blockToMove;
private final Facing moveDirection;
private final List<BlockPos> toMove = Lists.<BlockPos>newArrayList();
private final List<BlockPos> toDestroy = Lists.<BlockPos>newArrayList();
public BlockPistonStructureHelper(World worldIn, BlockPos posIn, Facing pistonFacing, boolean extending)
public BlockPistonStructureHelper(AWorldServer worldIn, BlockPos posIn, Facing pistonFacing, boolean extending)
{
this.world = worldIn;
this.pistonPos = posIn;
@ -277,14 +277,14 @@ public class BlockPistonBase extends Block implements Directional
if (!worldIn.client)
{
this.checkForMove(worldIn, pos, state);
this.checkForMove((AWorldServer)worldIn, pos, state);
}
}
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!worldIn.client)
{
@ -309,7 +309,7 @@ public class BlockPistonBase extends Block implements Directional
return this.getState().withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)).withProperty(EXTENDED, Boolean.valueOf(false));
}
private void checkForMove(World worldIn, BlockPos pos, State state)
private void checkForMove(AWorldServer worldIn, BlockPos pos, State state)
{
Facing enumfacing = (Facing)state.getValue(FACING);
boolean flag = this.shouldBeExtended(worldIn, pos, enumfacing);
@ -349,7 +349,7 @@ public class BlockPistonBase extends Block implements Directional
}
}
private boolean shouldBeExtended(World worldIn, BlockPos pos, Facing facing)
private boolean shouldBeExtended(AWorldServer worldIn, BlockPos pos, Facing facing)
{
// for (Facing enumfacing : Facing.values())
// {
@ -443,12 +443,6 @@ public class BlockPistonBase extends Block implements Directional
return false;
}
public static Facing getFacing(int meta)
{
int i = meta & 7;
return i > 5 ? Facing.getFront(0) : Facing.getFront(i);
}
public static Facing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLiving entityIn)
{
if (ExtMath.absf((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && ExtMath.absf((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F)
@ -469,7 +463,7 @@ public class BlockPistonBase extends Block implements Directional
return entityIn.getHorizontalFacing().getOpposite();
}
public static boolean canPush(Block blockIn, World worldIn, BlockPos pos, Facing direction, boolean allowDestroy)
public static boolean canPush(Block blockIn, AWorldServer worldIn, BlockPos pos, Facing direction, boolean allowDestroy)
{
if (blockIn == Blocks.obsidian)
{
@ -523,7 +517,7 @@ public class BlockPistonBase extends Block implements Directional
}
}
private boolean doMove(World worldIn, BlockPos pos, Facing direction, boolean extending)
private boolean doMove(AWorldServer worldIn, BlockPos pos, Facing direction, boolean extending)
{
if (!extending)
{
@ -594,7 +588,7 @@ public class BlockPistonBase extends Block implements Directional
}
}
private void launchWithSlimeBlock(World world, BlockPos pos, Facing pistonFacing, boolean extending)
private void launchWithSlimeBlock(AWorldServer world, BlockPos pos, Facing pistonFacing, boolean extending)
{
float step = 0.25f;

View file

@ -174,7 +174,7 @@ public class BlockPistonHead extends Block implements Directional
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
Facing enumfacing = (Facing)state.getValue(FACING);
BlockPos blockpos = pos.offset(enumfacing.getOpposite());

View file

@ -107,7 +107,7 @@ public class BlockRail extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!worldIn.client)
{

View file

@ -123,7 +123,7 @@ public abstract class BlockTorch extends Block implements Directional
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
this.onNeighborChangeInternal(worldIn, pos, state);
}

View file

@ -82,7 +82,7 @@ public class BlockTripWire extends Block
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
boolean flag = ((Boolean)state.getValue(SUSPENDED)).booleanValue();
boolean flag1 = !worldIn.isBlockSolid(pos.down());
@ -137,7 +137,7 @@ public class BlockTripWire extends Block
}
}
private void notifyHook(World worldIn, BlockPos pos, State state)
private void notifyHook(AWorldServer worldIn, BlockPos pos, State state)
{
for (Facing enumfacing : new Facing[] {Facing.SOUTH, Facing.WEST})
{
@ -173,7 +173,7 @@ public class BlockTripWire extends Block
{
if (!((Boolean)state.getValue(POWERED)).booleanValue())
{
this.updateState(worldIn, pos);
this.updateState((AWorldServer)worldIn, pos);
}
}
}
@ -189,7 +189,7 @@ public class BlockTripWire extends Block
// }
}
private void updateState(World worldIn, BlockPos pos)
private void updateState(AWorldServer worldIn, BlockPos pos)
{
State iblockstate = worldIn.getState(pos);
boolean flag = ((Boolean)iblockstate.getValue(POWERED)).booleanValue();

View file

@ -106,13 +106,14 @@ public class BlockTripWireHook extends Block implements Rotatable
*/
public void onPlace(World worldIn, BlockPos pos, State state, EntityLiving placer)
{
this.triggerHookAt(worldIn, pos, state, false, false, -1, (State)null);
if(!worldIn.client)
this.triggerHookAt((AWorldServer)worldIn, pos, state, false, false, -1, (State)null);
}
/**
* Called when a neighboring block changes.
*/
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (neighborBlock != this)
{
@ -129,7 +130,7 @@ public class BlockTripWireHook extends Block implements Rotatable
}
}
public void triggerHookAt(World worldIn, BlockPos pos, State hookState, boolean removed, boolean triggered, int wireDist, State wireState)
public void triggerHookAt(AWorldServer worldIn, BlockPos pos, State hookState, boolean removed, boolean triggered, int wireDist, State wireState)
{
Facing enumfacing = (Facing)hookState.getValue(FACING);
boolean attached = ((Boolean)hookState.getValue(ATTACHED)).booleanValue();
@ -227,7 +228,7 @@ public class BlockTripWireHook extends Block implements Rotatable
this.triggerHookAt(worldIn, pos, state, false, true, -1, (State)null);
}
private void playerTriggerSounds(World worldIn, BlockPos pos, boolean attached, boolean powered, boolean wasAttached, boolean wasPowered)
private void playerTriggerSounds(AWorldServer worldIn, BlockPos pos, boolean attached, boolean powered, boolean wasAttached, boolean wasPowered)
{
if (powered && !wasPowered)
{
@ -247,7 +248,7 @@ public class BlockTripWireHook extends Block implements Rotatable
}
}
private void notifyTriggered(World worldIn, BlockPos pos, Facing face)
private void notifyTriggered(AWorldServer worldIn, BlockPos pos, Facing face)
{
worldIn.notifyNeighborsOfStateChange(pos, this);
worldIn.notifyNeighborsOfStateChange(pos.offset(face.getOpposite()), this);

View file

@ -19,7 +19,6 @@ import common.rng.Random;
import common.util.BlockPos;
import common.util.Facing;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.State;
import common.world.World;
@ -106,7 +105,7 @@ public class BlockWarpChest extends Block implements Rotatable
// return new TileEntityWarpChest();
// }
public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
{
for (int i = 0; i < 3; ++i)
{

View file

@ -15,6 +15,7 @@ import common.tileentity.TileEntitySign;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.Facing;
import common.world.AWorldServer;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
@ -39,7 +40,7 @@ public class BlockStandingSign extends BlockSign implements Rotatable
}
}
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
if (!worldIn.getState(pos.down()).getBlock().getMaterial().isSolid())
{

View file

@ -7,9 +7,9 @@ import common.model.ModelProvider;
import common.model.ModelRotation;
import common.util.BlockPos;
import common.util.Facing;
import common.world.AWorldServer;
import common.world.IWorldAccess;
import common.world.State;
import common.world.World;
public class BlockWallSign extends BlockSign implements Rotatable
{
@ -42,7 +42,7 @@ public class BlockWallSign extends BlockSign implements Rotatable
}
}
public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock)
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
{
Facing enumfacing = (Facing)state.getValue(FACING);

View file

@ -16,7 +16,6 @@ import common.util.ExtMath;
import common.util.ParticleType;
import common.util.Vec3;
import common.vars.Vars;
import common.world.AWorldClient;
import common.world.World;
public class EntityDragon extends EntityLiving implements IEntityMultiPart
@ -110,7 +109,7 @@ public class EntityDragon extends EntityLiving implements IEntityMultiPart
if (f1 <= -0.3F && f >= -0.3F) // && !this.isSilent())
{
((AWorldClient)this.worldObj).playSound(this.posX, this.posY, this.posZ, SoundEvent.DRAGON_WINGS, 5.0F);
this.worldObj.playSound(this.posX, this.posY, this.posZ, SoundEvent.DRAGON_WINGS, 5.0F);
}
}

View file

@ -10,7 +10,6 @@ import common.init.SoundEvent;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.vars.Vars;
import common.world.AWorldClient;
import common.world.World;
public class EntityLightning extends EntityWeatherEffect
@ -74,11 +73,8 @@ public class EntityLightning extends EntityWeatherEffect
if (this.lightningState >= 0)
{
if (this.worldObj.client)
{
((AWorldClient)this.worldObj).setLastLightning(2, this.color);
}
else // if(this.damage > 0)
this.worldObj.setLastLightning(2, this.color);
if (!this.worldObj.client)
{
double d0 = 3.0D;
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, new BoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + 6.0D + d0, this.posZ + d0));

View file

@ -4,7 +4,6 @@ import common.ai.AISmallFireballAttack;
import common.init.SoundEvent;
import common.rng.Random;
import common.util.ParticleType;
import common.world.AWorldClient;
import common.world.World;
public class EntityDarkMage extends EntityHoveringNPC {
@ -85,7 +84,7 @@ public class EntityDarkMage extends EntityHoveringNPC {
{
if(this.worldObj.client && this.isAttacking()) {
if(this.rand.chance(24)) { // && !this.isSilent()) {
((AWorldClient)this.worldObj).playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, SoundEvent.FIRE,
this.worldObj.playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, SoundEvent.FIRE,
1.0F + this.rand.floatv());
}
for(int i = 0; i < 2; ++i) {

View file

@ -96,7 +96,6 @@ import common.util.Vec3;
import common.util.WorldPos;
import common.vars.Vars;
import common.village.MerchantRecipeList;
import common.world.AWorldClient;
import common.world.World;
import common.world.AWorldServer;
@ -2075,7 +2074,7 @@ public abstract class EntityNPC extends EntityLiving
if(this.connection != null)
this.connection.playSound(name, volume);
else if(this.client != null)
((AWorldClient)this.worldObj).playSound(this.posX, this.posY, this.posZ, name, volume);
this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume);
else if(!this.slave)
super.playSound(name, volume);
}

View file

@ -10,6 +10,7 @@ import common.item.ItemStack;
import common.tags.TagObject;
import java.util.List;
import common.util.BoundingBox;
import common.world.AWorldServer;
public class TileEntityChest extends TileEntity implements ITickable, IInventory
{
@ -239,8 +240,10 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory
++this.numPlayersUsing;
this.worldObj.playAuxSFX(2016, this.pos, this.numPlayersUsing);
this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
if(!this.worldObj.client) {
((AWorldServer)this.worldObj).notifyNeighborsOfStateChange(this.pos, this.getBlockType());
((AWorldServer)this.worldObj).notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
}
// }
}
@ -250,8 +253,10 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory
{
--this.numPlayersUsing;
this.worldObj.playAuxSFX(2016, this.pos, this.numPlayersUsing);
this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
if(!this.worldObj.client) {
((AWorldServer)this.worldObj).notifyNeighborsOfStateChange(this.pos, this.getBlockType());
((AWorldServer)this.worldObj).notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
}
}
}

View file

@ -25,6 +25,14 @@ public class LongHashMap<V>
{
this.mask = this.hashArray.length - 1;
}
public void clear() {
this.hashArray = new LongHashMap.Entry[4096];
this.numHashElements = 0;
this.mask = this.hashArray.length - 1;
this.capacity = 3072;
this.modCount = 0;
}
/**
* returns the hashed key given the original key

View file

@ -1,13 +0,0 @@
package common.world;
import common.dimension.Dimension;
import common.init.SoundEvent;
public abstract class AWorldClient extends World {
protected AWorldClient(Dimension dim) {
super(dim, true);
}
public abstract void playSound(double x, double y, double z, SoundEvent sound, float volume);
public abstract void setLastLightning(int last, int color);
}

View file

@ -52,4 +52,6 @@ public abstract class AWorldServer extends World {
public abstract void generateTree(BlockPos pos, State state, Random rand);
public abstract float getGenTemperature(int x, int z);
public abstract float getGenHumidity(int x, int z);
public abstract void scheduleUpdate(BlockPos pos, Block blockIn, int delay);
public abstract void notifyNeighborsOfStateChange(BlockPos pos, Block blockType);
}

View file

@ -57,14 +57,14 @@ public abstract class World implements IWorldAccess {
public final boolean client;
public final Random rand = new Random();
public final List<Entity> entities = Lists.<Entity>newArrayList();
protected final List<Entity> unloaded = Lists.<Entity>newArrayList();
protected final List<TileEntity> tiles = Lists.<TileEntity>newArrayList();
public final List<Entity> unloaded = Lists.<Entity>newArrayList();
public final List<TileEntity> tiles = Lists.<TileEntity>newArrayList();
protected final List<TileEntity> tickable = Lists.<TileEntity>newArrayList();
protected final List<TileEntity> addedTiles = Lists.<TileEntity>newArrayList();
protected final List<TileEntity> removeTiles = Lists.<TileEntity>newArrayList();
public final List<EntityNPC> players = Lists.<EntityNPC>newArrayList();
public final List<Entity> effects = Lists.<Entity>newArrayList();
protected final IntHashMap<Entity> entityIds = new IntHashMap();
public final IntHashMap<Entity> entityIds = new IntHashMap();
protected final Set<ChunkPos> active = Sets.<ChunkPos>newHashSet();
protected final int[] lightUpdate = new int[32768];
public final Dimension dimension;
@ -187,8 +187,6 @@ public abstract class World implements IWorldAccess {
return this.formatTime(player == null ? null : player.getOrigin().getDimension(), days);
}
protected abstract float getTemperature(BlockPos pos);
public boolean isAirBlock(BlockPos pos) {
return this.getState(pos).getBlock() == Blocks.air;
}
@ -240,8 +238,6 @@ public abstract class World implements IWorldAccess {
}
}
protected abstract boolean isLoaded(int x, int z, boolean allowEmpty);
public Chunk getChunk(BlockPos pos) {
return this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
}
@ -251,37 +247,19 @@ public abstract class World implements IWorldAccess {
* 4 prevents the block from being re-rendered on client worlds
*/
public boolean setState(BlockPos pos, State newState, int flags) {
if(!isValid(pos)) {
if(!isValid(pos))
return false;
}
else {
Chunk chunk = this.getChunk(pos);
Block block = newState.getBlock();
State iblockstate = chunk.setState(pos, newState);
if(iblockstate == null) {
return false;
}
else {
Block block1 = iblockstate.getBlock();
if(block.getLightOpacity() != block1.getLightOpacity() || block.getLight() != block1.getLight()) {
// this.profiler.start("checkLight");
this.checkLight(pos);
// this.profiler.end();
}
if((flags & 2) != 0 && (!this.client || (flags & 4) == 0) && chunk.isPopulated()) {
this.markBlockForUpdate(pos);
}
if(!this.client && (flags & 1) != 0) {
this.notifyNeighborsOfStateChange(pos, iblockstate.getBlock());
}
return true;
}
}
Chunk chunk = this.getChunk(pos);
Block block = newState.getBlock();
State iblockstate = chunk.setState(pos, newState);
if(iblockstate == null)
return false;
Block block1 = iblockstate.getBlock();
if(block.getLightOpacity() != block1.getLightOpacity() || block.getLight() != block1.getLight())
this.checkLight(pos);
if((flags & 2) != 0 && (flags & 4) == 0 && chunk.isPopulated())
this.markBlockForUpdate(pos);
return true;
}
public boolean setState(BlockPos pos, State state) {
@ -330,49 +308,6 @@ public abstract class World implements IWorldAccess {
this.markBlockRangeForRenderUpdate(rangeMin.getX(), rangeMin.getY(), rangeMin.getZ(), rangeMax.getX(), rangeMax.getY(), rangeMax.getZ());
}
public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) {
this.notifyBlockOfStateChange(pos.west(), blockType);
this.notifyBlockOfStateChange(pos.east(), blockType);
this.notifyBlockOfStateChange(pos.down(), blockType);
this.notifyBlockOfStateChange(pos.up(), blockType);
this.notifyBlockOfStateChange(pos.north(), blockType);
this.notifyBlockOfStateChange(pos.south(), blockType);
}
public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, Facing skipSide) {
if(skipSide != Facing.WEST) {
this.notifyBlockOfStateChange(pos.west(), blockType);
}
if(skipSide != Facing.EAST) {
this.notifyBlockOfStateChange(pos.east(), blockType);
}
if(skipSide != Facing.DOWN) {
this.notifyBlockOfStateChange(pos.down(), blockType);
}
if(skipSide != Facing.UP) {
this.notifyBlockOfStateChange(pos.up(), blockType);
}
if(skipSide != Facing.NORTH) {
this.notifyBlockOfStateChange(pos.north(), blockType);
}
if(skipSide != Facing.SOUTH) {
this.notifyBlockOfStateChange(pos.south(), blockType);
}
}
public void notifyBlockOfStateChange(BlockPos pos, final Block blockIn) {
if(!this.client) {
State iblockstate = this.getState(pos);
iblockstate.getBlock().onUpdate(this, pos, iblockstate, blockIn);
}
}
public boolean canSeeSky(BlockPos pos) {
return this.getChunk(pos).canSeeSky(pos);
}
@ -1546,7 +1481,7 @@ public abstract class World implements IWorldAccess {
this.temp = this.getBaseTemperature() + this.weather.getTemperature();
}
protected void setActivePlayerChunksAndCheckLight(int l) {
public Set<ChunkPos> setActivePlayerChunksAndCheckLight(int l) {
this.active.clear();
// this.profiler.start("buildList");
@ -1575,6 +1510,8 @@ public abstract class World implements IWorldAccess {
int j2 = ExtMath.floord(entityplayer1.posZ) + this.rand.zrange(11) - 5;
this.checkLight(new BlockPos(l1, i2, j2));
}
return this.active;
// this.profiler.end();
}
@ -2029,23 +1966,35 @@ public abstract class World implements IWorldAccess {
this.playAuxSFX(null, type, pos, data);
}
public void scheduleUpdate(BlockPos pos, Block blockIn, int delay) {
public final void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord) {
this.spawnParticle(particleType, xCoord, yCoord, zCoord, 0);
}
public void playSound(SoundEvent sound, double x, double y, double z, float volume) {
}
public void playSound(double x, double y, double z, SoundEvent sound, float volume) {
}
public void setLastLightning(int last, int color) {
}
public void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, int data) {
}
public final void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord) {
this.spawnParticle(particleType, xCoord, yCoord, zCoord, 0);
public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) {
}
protected void notifyLightSet(BlockPos pos) {
}
protected abstract float getTemperature(BlockPos pos);
protected abstract boolean isLoaded(int x, int z, boolean allowEmpty);
public abstract Chunk getChunk(int x, int z);
public abstract void markBlockForUpdate(BlockPos pos);
protected abstract void notifyLightSet(BlockPos pos);
public abstract void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2);
public abstract void playSound(SoundEvent sound, double x, double y, double z, float volume);
protected abstract void onEntityAdded(Entity entityIn);
protected abstract void onEntityRemoved(Entity entityIn);
public abstract void playAuxSFX(EntityNPC player, int sfxType, BlockPos blockPosIn, int data);
public abstract void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress);
}