From 1ce918c0af151fc0409ffba500eb912c90d966fd Mon Sep 17 00:00:00 2001 From: Sen Date: Mon, 1 Sep 2025 16:03:50 +0200 Subject: [PATCH] misc updates, remove mipmapping --- client/src/main/java/client/Client.java | 96 ++--- .../src/main/java/client/gui/GuiConsole.java | 6 +- .../client/gui/container/GuiCrafting.java | 4 +- .../main/java/client/gui/ingame/GuiSign.java | 6 +- .../java/client/gui/options/GuiBinds.java | 9 +- .../java/client/gui/options/GuiDisplay.java | 122 +------ .../java/client/gui/options/GuiGraphics.java | 127 +++++-- .../java/client/gui/options/GuiSound.java | 17 +- .../java/client/gui/options/GuiStyle.java | 23 +- .../java/client/network/ClientPlayer.java | 12 +- .../java/client/renderer/EffectRenderer.java | 10 +- .../java/client/renderer/ItemRenderer.java | 12 +- .../java/client/renderer/MatrixState.java | 8 +- .../client/renderer/RegionRenderCache.java | 20 +- .../main/java/client/renderer/Renderer.java | 190 +++++----- .../java/client/renderer/ShaderContext.java | 2 +- .../java/client/renderer/ViewFrustum.java | 8 +- .../client/renderer/chunk/RenderChunk.java | 27 +- .../java/client/renderer/chunk/VisGraph.java | 8 +- .../renderer/entity/RenderBlockEntity.java | 4 +- .../renderer/entity/RenderFallingBlock.java | 6 +- .../client/renderer/entity/RenderFish.java | 14 +- .../client/renderer/entity/RenderManager.java | 6 +- .../renderer/entity/RenderMinecart.java | 18 +- .../renderer/entity/RenderTntPrimed.java | 4 +- .../client/renderer/layers/LayerArmor.java | 3 - .../client/renderer/model/TexturedQuad.java | 14 +- .../client/renderer/texture/TextureMap.java | 8 +- .../client/renderer/texture/TextureUtil.java | 8 +- .../renderer/tileentity/DisplayRenderer.java | 4 +- .../renderer/tileentity/SpecialRenderer.java | 4 +- .../java/client/util/PlayerController.java | 26 +- .../main/java/client/world/ChunkClient.java | 17 +- .../main/java/client/world/ChunkEmpty.java | 26 +- .../src/main/java/common/ai/AIFireAttack.java | 12 +- .../main/java/common/ai/AIFireballAttack.java | 14 +- .../java/common/ai/AIFlyingBoxAttack.java | 4 +- .../java/common/ai/AISmallFireballAttack.java | 4 +- .../common/ai/EntityAIAttackOnCollide.java | 4 +- .../java/common/ai/EntityAIAvoidEntity.java | 4 +- .../main/java/common/ai/EntityAICatSit.java | 4 +- .../common/ai/EntityAIControlledByPlayer.java | 8 +- .../java/common/ai/EntityAIDoorInteract.java | 10 +- .../main/java/common/ai/EntityAIEatGrass.java | 8 +- .../common/ai/EntityAIHarvestFarmland.java | 4 +- .../java/common/ai/EntityAIMoveToBlock.java | 10 +- .../ai/EntityAIMoveTowardsRestriction.java | 10 +- .../common/ai/EntityAIMoveTowardsTarget.java | 6 +- .../main/java/common/ai/EntityAIPanic.java | 6 +- .../src/main/java/common/ai/EntityAIPlay.java | 2 +- .../common/ai/EntityAIRunAroundLikeCrazy.java | 6 +- .../java/common/ai/EntityAITakePlace.java | 4 +- .../main/java/common/ai/EntityAITarget.java | 4 +- .../main/java/common/ai/EntityAIWander.java | 6 +- .../common/ai/RandomPositionGenerator.java | 8 +- common/src/main/java/common/block/Block.java | 126 +++---- .../src/main/java/common/block/BlockAir.java | 8 +- .../main/java/common/block/BlockFalling.java | 18 +- .../common/block/artificial/BlockBed.java | 26 +- .../common/block/artificial/BlockCake.java | 14 +- .../common/block/artificial/BlockCarpet.java | 14 +- .../common/block/artificial/BlockDoor.java | 46 +-- .../block/artificial/BlockDragonEgg.java | 26 +- .../common/block/artificial/BlockFence.java | 16 +- .../block/artificial/BlockFenceGate.java | 18 +- .../block/artificial/BlockFloorPortal.java | 20 +- .../block/artificial/BlockFlowerPot.java | 10 +- .../common/block/artificial/BlockGlass.java | 7 +- .../common/block/artificial/BlockHay.java | 4 +- .../common/block/artificial/BlockLadder.java | 16 +- .../block/artificial/BlockMetalBlock.java | 1 - .../common/block/artificial/BlockPane.java | 13 +- .../common/block/artificial/BlockPortal.java | 30 +- .../block/artificial/BlockPortalFrame.java | 12 +- .../block/artificial/BlockQuartzPillar.java | 4 +- .../common/block/artificial/BlockSkull.java | 8 +- .../common/block/artificial/BlockSlab.java | 16 +- .../common/block/artificial/BlockStairs.java | 26 +- .../block/artificial/BlockTrapDoor.java | 16 +- .../common/block/artificial/BlockWall.java | 14 +- .../block/foliage/BlockBlackenedSoil.java | 6 +- .../common/block/foliage/BlockBlueShroom.java | 13 +- .../java/common/block/foliage/BlockBush.java | 14 +- .../common/block/foliage/BlockCactus.java | 18 +- .../java/common/block/foliage/BlockCrops.java | 28 +- .../common/block/foliage/BlockDeadBush.java | 6 +- .../block/foliage/BlockDoublePlant.java | 34 +- .../common/block/foliage/BlockFarmland.java | 19 +- .../common/block/foliage/BlockFlower.java | 4 +- .../java/common/block/foliage/BlockGrass.java | 14 +- .../common/block/foliage/BlockLeaves.java | 23 +- .../common/block/foliage/BlockLilyPad.java | 14 +- .../java/common/block/foliage/BlockLog.java | 8 +- .../common/block/foliage/BlockMushroom.java | 19 +- .../common/block/foliage/BlockMycelium.java | 10 +- .../common/block/foliage/BlockPotato.java | 4 +- .../common/block/foliage/BlockPumpkin.java | 4 +- .../java/common/block/foliage/BlockReed.java | 14 +- .../common/block/foliage/BlockSapling.java | 12 +- .../common/block/foliage/BlockSoulGrass.java | 8 +- .../java/common/block/foliage/BlockStem.java | 18 +- .../java/common/block/foliage/BlockSwamp.java | 10 +- .../common/block/foliage/BlockTallGrass.java | 16 +- .../common/block/foliage/BlockTianSoil.java | 4 +- .../java/common/block/foliage/BlockVine.java | 32 +- .../java/common/block/foliage/IGrowable.java | 8 +- .../block/liquid/BlockDynamicLiquid.java | 24 +- .../java/common/block/liquid/BlockLiquid.java | 47 ++- .../block/liquid/BlockStaticLiquid.java | 16 +- .../common/block/natural/BlockBedrock.java | 4 +- .../block/natural/BlockBlackenedDirt.java | 6 +- .../block/natural/BlockCompressable.java | 4 +- .../java/common/block/natural/BlockFire.java | 30 +- .../common/block/natural/BlockGlowstone.java | 4 +- .../java/common/block/natural/BlockIce.java | 8 +- .../java/common/block/natural/BlockOre.java | 4 +- .../common/block/natural/BlockPodzol.java | 4 +- .../java/common/block/natural/BlockSlime.java | 6 +- .../java/common/block/natural/BlockSnow.java | 26 +- .../common/block/natural/BlockSnowBlock.java | 4 +- .../common/block/natural/BlockSoulFire.java | 6 +- .../common/block/natural/BlockSoulSand.java | 6 +- .../java/common/block/natural/BlockWeb.java | 6 +- .../common/block/tech/BlockActiveDisplay.java | 14 +- .../java/common/block/tech/BlockAnvil.java | 16 +- .../block/tech/BlockBasePressurePlate.java | 30 +- .../common/block/tech/BlockBrewingStand.java | 6 +- .../java/common/block/tech/BlockButton.java | 36 +- .../java/common/block/tech/BlockCauldron.java | 12 +- .../java/common/block/tech/BlockChest.java | 22 +- .../java/common/block/tech/BlockCore.java | 6 +- .../block/tech/BlockDirectionalPipe.java | 4 +- .../common/block/tech/BlockDispenser.java | 6 +- .../java/common/block/tech/BlockDisplay.java | 34 +- .../block/tech/BlockEnchantmentTable.java | 8 +- .../java/common/block/tech/BlockFurnace.java | 14 +- .../java/common/block/tech/BlockHook.java | 36 +- .../block/tech/BlockInactiveDisplay.java | 8 +- .../java/common/block/tech/BlockLever.java | 24 +- .../java/common/block/tech/BlockLitTorch.java | 10 +- .../java/common/block/tech/BlockMachine.java | 8 +- .../java/common/block/tech/BlockNuke.java | 8 +- .../java/common/block/tech/BlockPipe.java | 14 +- .../common/block/tech/BlockPistonBase.java | 76 ++-- .../common/block/tech/BlockPistonHead.java | 18 +- .../common/block/tech/BlockPressurePlate.java | 6 +- .../tech/BlockPressurePlateWeighted.java | 8 +- .../java/common/block/tech/BlockRail.java | 60 ++-- .../java/common/block/tech/BlockSign.java | 16 +- .../common/block/tech/BlockStandingSign.java | 10 +- .../java/common/block/tech/BlockString.java | 24 +- .../main/java/common/block/tech/BlockTNT.java | 16 +- .../block/tech/BlockToggleableLight.java | 6 +- .../java/common/block/tech/BlockTorch.java | 26 +- .../common/block/tech/BlockUnlitTorch.java | 4 +- .../java/common/block/tech/BlockWallSign.java | 6 +- .../common/block/tech/BlockWarpChest.java | 8 +- .../java/common/block/tech/BlockWire.java | 20 +- .../common/block/tech/BlockWorkbench.java | 8 +- .../main/java/common/dimension/Dimension.java | 6 +- .../main/java/common/entity/DataWatcher.java | 8 +- .../src/main/java/common/entity/Entity.java | 55 +-- .../java/common/entity/animal/EntityBat.java | 14 +- .../common/entity/animal/EntityDragon.java | 4 +- .../common/entity/animal/EntityHorse.java | 8 +- .../common/entity/animal/EntityMouse.java | 6 +- .../common/entity/animal/EntityRabbit.java | 10 +- .../common/entity/effect/EntityLightning.java | 4 +- .../java/common/entity/item/EntityBoat.java | 8 +- .../java/common/entity/item/EntityCart.java | 22 +- .../common/entity/item/EntityFalling.java | 6 +- .../java/common/entity/item/EntityItem.java | 8 +- .../common/entity/item/EntityLeashKnot.java | 18 +- .../java/common/entity/item/EntityXp.java | 8 +- .../common/entity/npc/EntityArachnoid.java | 1 - .../common/entity/npc/EntityCultivator.java | 4 +- .../common/entity/npc/EntityFlyingNPC.java | 4 +- .../java/common/entity/npc/EntityHuman.java | 6 +- .../java/common/entity/npc/EntityNPC.java | 52 +-- .../java/common/entity/npc/EntitySlime.java | 6 +- .../java/common/entity/npc/EntityUndead.java | 1 - .../java/common/entity/npc/EntityZombie.java | 7 +- .../common/entity/npc/PlayerCharacter.java | 4 +- .../common/entity/projectile/EntityArrow.java | 16 +- .../entity/projectile/EntityBullet.java | 8 +- .../entity/projectile/EntityFireCharge.java | 4 +- .../common/entity/projectile/EntityHook.java | 14 +- .../entity/projectile/EntityMissile.java | 4 +- .../entity/projectile/EntityPotion.java | 4 +- .../entity/projectile/EntityProjectile.java | 16 +- .../common/entity/types/EntityAnimal.java | 6 +- .../common/entity/types/EntityLiving.java | 58 +-- .../common/entity/types/EntityThrowable.java | 8 +- .../inventory/ContainerEnchantment.java | 8 +- .../common/inventory/ContainerRepair.java | 8 +- .../common/inventory/ContainerWorkbench.java | 6 +- .../common/inventory/InventoryWarpChest.java | 6 +- common/src/main/java/common/item/Item.java | 12 +- .../common/item/consumable/ItemPotion.java | 8 +- .../common/item/consumable/ItemSeedFood.java | 4 +- .../java/common/item/material/ItemArmor.java | 6 +- .../java/common/item/material/ItemBottle.java | 4 +- .../java/common/item/material/ItemBucket.java | 29 +- .../java/common/item/material/ItemDye.java | 4 +- .../item/material/ItemGrindedBones.java | 12 +- .../java/common/item/material/ItemSeeds.java | 4 +- .../item/projectile/ItemChargedOrb.java | 14 +- .../java/common/item/projectile/ItemDie.java | 6 +- .../common/item/projectile/ItemDynamite.java | 6 +- .../java/common/item/projectile/ItemEgg.java | 6 +- .../common/item/projectile/ItemFireball.java | 12 +- .../common/item/projectile/ItemSnowball.java | 6 +- .../java/common/item/spawner/ItemBoat.java | 12 +- .../common/item/spawner/ItemCharTemplate.java | 6 +- .../common/item/spawner/ItemMinecart.java | 8 +- .../common/item/spawner/ItemMobTemplate.java | 6 +- .../java/common/item/tool/ItemCamera.java | 6 +- .../java/common/item/tool/ItemEditor.java | 4 +- .../main/java/common/item/tool/ItemFire.java | 8 +- .../main/java/common/item/tool/ItemHoe.java | 6 +- .../main/java/common/item/tool/ItemLead.java | 6 +- .../java/common/item/tool/ItemMagnet.java | 2 +- .../java/common/item/tool/ItemScanner.java | 6 +- .../common/item/tool/ItemSpaceNavigator.java | 8 +- .../main/java/common/item/tool/ItemTool.java | 4 +- .../main/java/common/item/tool/ItemWand.java | 8 +- .../java/common/item/weapon/ItemArrow.java | 6 +- .../common/item/weapon/ItemBanHammer.java | 6 +- .../java/common/item/weapon/ItemTrident.java | 2 +- .../src/main/java/common/network/IPlayer.java | 6 +- .../java/common/network/PacketBuffer.java | 8 +- .../main/java/common/packet/CPacketBreak.java | 8 +- .../java/common/packet/CPacketComplete.java | 8 +- .../main/java/common/packet/CPacketPlace.java | 10 +- .../main/java/common/packet/CPacketSign.java | 8 +- .../common/packet/SPacketBlockChange.java | 8 +- .../common/packet/SPacketCharacterList.java | 4 +- .../java/common/packet/SPacketEffect.java | 8 +- .../java/common/packet/SPacketExplosion.java | 16 +- .../packet/SPacketMultiBlockChange.java | 6 +- .../java/common/packet/SPacketOpenWindow.java | 8 +- .../common/packet/SPacketSignEditorOpen.java | 8 +- .../common/packet/SPacketSpawnObject.java | 10 +- .../common/packet/SPacketUpdateDevice.java | 6 +- .../common/packet/SPacketUpdateDisplay.java | 8 +- .../java/common/packet/SPacketUpdatePipe.java | 6 +- .../java/common/packet/SPacketUpdateSign.java | 8 +- .../java/common/pathfinding/PathCache.java | 6 +- .../java/common/pathfinding/PathEntity.java | 2 +- .../java/common/pathfinding/PathFinder.java | 4 +- .../java/common/pathfinding/PathNavigate.java | 22 +- .../pathfinding/PathNavigateClimber.java | 12 +- .../pathfinding/PathNavigateGround.java | 38 +- .../common/pathfinding/SwimNodeProcessor.java | 4 +- .../common/pathfinding/WalkNodeProcessor.java | 9 +- .../common/tileentity/DeviceDispenser.java | 4 +- .../java/common/tileentity/TileEntity.java | 10 +- .../common/tileentity/TileEntityItemPipe.java | 8 +- .../src/main/java/common/util/BlockPos.java | 339 ------------------ .../main/java/common/util/BoundingBox.java | 34 +- .../util/{WorldPos.java => GlobalPos.java} | 23 +- .../main/java/common/util/HitPosition.java | 6 +- .../src/main/java/common/util/LocalPos.java | 147 ++++++++ .../src/main/java/common/util/MutablePos.java | 84 +++++ .../main/java/common/util/NibbleArray.java | 31 -- .../src/main/java/common/util/Position.java | 10 +- common/src/main/java/common/util/Vec3.java | 285 +++++---------- common/src/main/java/common/util/Vec3i.java | 157 +++----- .../src/main/java/common/village/Village.java | 26 +- .../java/common/village/VillageDoorInfo.java | 20 +- .../main/java/common/world/AWorldServer.java | 32 +- .../main/java/common/world/BlockArray.java | 1 - common/src/main/java/common/world/Chunk.java | 32 +- .../main/java/common/world/IBlockAccess.java | 4 +- .../main/java/common/world/IWorldAccess.java | 6 +- common/src/main/java/common/world/World.java | 163 ++++----- server/src/main/java/server/Server.java | 30 +- .../server/clipboard/ClipboardPlacer.java | 24 +- .../src/main/java/server/command/Command.java | 8 +- .../java/server/command/DoubleParser.java | 4 +- .../main/java/server/command/Executor.java | 4 +- .../main/java/server/command/IntParser.java | 4 +- .../server/command/commands/CommandBlock.java | 4 +- .../command/commands/CommandCamera.java | 2 +- .../command/commands/CommandDelwarp.java | 2 +- .../command/commands/CommandEffect.java | 2 +- .../command/commands/CommandEntity.java | 4 +- .../command/commands/CommandExplode.java | 6 +- .../server/command/commands/CommandFind.java | 4 +- .../server/command/commands/CommandSet.java | 6 +- .../command/commands/CommandSetwarp.java | 6 +- .../command/commands/CommandShowwarp.java | 2 +- .../server/command/commands/CommandSpawn.java | 8 +- .../server/command/commands/CommandTele.java | 4 +- .../server/command/commands/CommandWarps.java | 2 +- .../server/command/commands/CommandWorld.java | 8 +- .../src/main/java/server/network/Player.java | 76 ++-- .../server/village/VillageCollection.java | 24 +- .../main/java/server/world/ChunkServer.java | 4 +- .../src/main/java/server/world/Converter.java | 23 +- .../java/server/world/NextTickListEntry.java | 6 +- server/src/main/java/server/world/Region.java | 8 +- .../src/main/java/server/world/Spawner.java | 12 +- .../main/java/server/world/WorldServer.java | 158 ++++---- .../server/worldgen/FeatureGenerator.java | 6 +- .../server/worldgen/caves/MapGenCaves.java | 4 +- .../server/worldgen/caves/MapGenRavine.java | 4 +- .../worldgen/component/FeatureDungeons.java | 12 +- .../worldgen/component/FeatureLakes.java | 8 +- .../worldgen/component/FeatureLiquids.java | 6 +- .../worldgen/component/FeatureOres.java | 10 +- .../feature/WorldGenAbandonedChest.java | 6 +- .../worldgen/feature/WorldGenAsteroid.java | 4 +- .../worldgen/feature/WorldGenBlockBlob.java | 6 +- .../server/worldgen/feature/WorldGenClay.java | 6 +- .../worldgen/feature/WorldGenClayExt.java | 6 +- .../worldgen/feature/WorldGenDesertWells.java | 4 +- .../server/worldgen/feature/WorldGenFire.java | 6 +- .../worldgen/feature/WorldGenGlowStone.java | 6 +- .../worldgen/feature/WorldGenHellLava.java | 4 +- .../worldgen/feature/WorldGenIcePath.java | 6 +- .../worldgen/feature/WorldGenIceSpike.java | 6 +- .../server/worldgen/feature/WorldGenSand.java | 6 +- .../worldgen/feature/WorldGenSpikes.java | 9 +- .../worldgen/foliage/FeatureDoublePlant.java | 6 +- .../worldgen/foliage/WorldGenBigMushroom.java | 9 +- .../worldgen/foliage/WorldGenCactus.java | 6 +- .../worldgen/foliage/WorldGenDeadBush.java | 6 +- .../worldgen/foliage/WorldGenFlowers.java | 6 +- .../worldgen/foliage/WorldGenMelon.java | 6 +- .../worldgen/foliage/WorldGenMushroom.java | 6 +- .../worldgen/foliage/WorldGenPumpkin.java | 6 +- .../server/worldgen/foliage/WorldGenReed.java | 8 +- .../worldgen/foliage/WorldGenShrub.java | 6 +- .../worldgen/foliage/WorldGenTallGrass.java | 6 +- .../worldgen/foliage/WorldGenVines.java | 4 +- .../worldgen/foliage/WorldGenWaterlily.java | 8 +- .../server/worldgen/layer/BiomeGenerator.java | 4 +- .../server/worldgen/populator/Populator.java | 4 +- .../populator/PopulatorAlphaLike.java | 4 +- .../populator/PopulatorAsteroids.java | 4 +- .../worldgen/populator/PopulatorBasic.java | 18 +- .../populator/PopulatorBlackened.java | 4 +- .../worldgen/populator/PopulatorChaos.java | 6 +- .../worldgen/populator/PopulatorDesert.java | 6 +- .../worldgen/populator/PopulatorForest.java | 10 +- .../worldgen/populator/PopulatorHell.java | 4 +- .../worldgen/populator/PopulatorHills.java | 4 +- .../worldgen/populator/PopulatorSavanna.java | 4 +- .../worldgen/populator/PopulatorSpikes.java | 4 +- .../worldgen/populator/PopulatorSwamp.java | 4 +- .../worldgen/populator/PopulatorTaiga.java | 6 +- .../populator/PopulatorTerranian.java | 4 +- .../worldgen/populator/PopulatorTian.java | 8 +- .../worldgen/populator/PopulatorTropical.java | 4 +- .../worldgen/replacer/ReplacerAltSimple.java | 4 +- .../structure/MapGenScatteredFeature.java | 4 +- .../worldgen/structure/MapGenStructure.java | 8 +- .../structure/StructureBoundingBox.java | 4 +- .../worldgen/structure/StructureBridge.java | 10 +- .../structure/StructureComponent.java | 25 +- .../structure/StructureMineshaft.java | 6 +- .../structure/StructureScattered.java | 7 +- .../structure/StructureStronghold.java | 8 +- .../worldgen/structure/StructureVillage.java | 13 +- .../worldgen/tree/WorldGenBaseTree.java | 23 +- .../server/worldgen/tree/WorldGenBigTree.java | 77 ++-- .../server/worldgen/tree/WorldGenBirch.java | 9 +- .../server/worldgen/tree/WorldGenDarkOak.java | 19 +- .../worldgen/tree/WorldGenHugeTree.java | 18 +- .../server/worldgen/tree/WorldGenJungle.java | 20 +- .../server/worldgen/tree/WorldGenPine.java | 14 +- .../server/worldgen/tree/WorldGenSavanna.java | 19 +- .../server/worldgen/tree/WorldGenSwamp.java | 21 +- .../server/worldgen/tree/WorldGenTaiga1.java | 9 +- .../server/worldgen/tree/WorldGenTaiga2.java | 9 +- .../server/worldgen/tree/WorldGenTree.java | 6 +- 377 files changed, 2910 insertions(+), 3223 deletions(-) delete mode 100755 common/src/main/java/common/util/BlockPos.java rename common/src/main/java/common/util/{WorldPos.java => GlobalPos.java} (59%) create mode 100755 common/src/main/java/common/util/LocalPos.java create mode 100644 common/src/main/java/common/util/MutablePos.java delete mode 100755 common/src/main/java/common/util/NibbleArray.java diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index f542f48a..b0f96cd6 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -168,7 +168,7 @@ import common.sound.EventType; import common.sound.MovingSoundMinecart; import common.sound.PositionedSound; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.CharValidator; import common.util.ChunkPos; @@ -176,13 +176,12 @@ import common.util.ExtMath; import common.util.HitPosition; import common.util.IntHashMap; import common.util.LongHashMap; +import common.util.MutablePos; import common.util.ParticleType; import common.util.Color; -import common.util.Displayable; import common.util.Util; import common.util.Var; import common.util.HitPosition.ObjectType; -import common.util.Identifyable; import common.vars.Vars; import common.world.Chunk; import common.world.State; @@ -211,28 +210,6 @@ import common.world.World; */ public class Client implements IThreadListener { - public static enum MipmapType implements Identifyable, Displayable { - NONE("off", "Keine"), - NEAREST("nearest", "Nächster nachbar"), - LINEAR("linear", "Linear interpoliert"); - - private final String name; - private final String display; - - private MipmapType(String name, String display) { - this.name = name; - this.display = display; - } - - public String getName() { - return this.name; - } - - public String getDisplay() { - return this.display; - } - } - public static class SyncFunction implements IntFunction { public void apply(IntVar cv, int value) { Client.CLIENT.sync(value); @@ -312,12 +289,6 @@ public class Client implements IThreadListener { } } - public static class MipmapFunction implements EnumFunction { - public void apply(EnumVar cv, MipmapType value) { - Client.CLIENT.updateTexture(); - } - } - public static class LightFunction implements FloatFunction { public void apply(FloatVar cv, float value) { Client.CLIENT.renderer.loadRenderers(); @@ -366,11 +337,11 @@ public class Client implements IThreadListener { return Client.this.getChunk(x, z); } - public Chunk getChunk(BlockPos pos) { + public Chunk getChunk(LocalPos pos) { return Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4); } - protected float getTemperature(BlockPos pos) { + protected float getTemperature(LocalPos pos) { if(!isValid(pos)) return 0.0f; ChunkClient chunk = Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4); @@ -385,19 +356,19 @@ public class Client implements IThreadListener { Client.this.effectRenderer.spawnParticle(Client.this.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, data); } - public void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data) { + public void playEffect(EntityNPC player, int sfxType, LocalPos blockPosIn, int data) { if(Client.this.getNetHandler() != null) Client.this.getNetHandler().playAuxSFX(sfxType, blockPosIn, data); } - public void markBlockForUpdate(BlockPos pos) { + public void markBlockForUpdate(LocalPos pos) { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); Client.this.renderer.markUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); } - public void clientNotifyLight(BlockPos pos) { + public void clientNotifyLight(LocalPos pos) { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); @@ -412,15 +383,15 @@ public class Client implements IThreadListener { Client.this.renderer.setLastLightning(last, color); } - public void checkBlockLight(BlockPos pos) { + public void checkBlockLight(LocalPos pos) { Client.this.renderer.checkBlockLight(pos); } - public int getCombinedLight(BlockPos pos) { + public int getCombinedLight(LocalPos pos) { return Client.this.renderer.getCombinedLight(pos); } - public int getCombinedBrightness(BlockPos pos) { + public int getCombinedBrightness(LocalPos pos) { return Client.this.renderer.getCombinedBrightness(pos); } } @@ -492,7 +463,6 @@ public class Client implements IThreadListener { public boolean freecam; public boolean servercam; public boolean shaders; - public boolean mipmaps; private int leftClickCounter; private int rightClickTimer; @@ -574,7 +544,7 @@ public class Client implements IThreadListener { public World world; public EntityNPC player; public HitPosition pointed; - public BlockPos pointedLiquid; + public LocalPos pointedLiquid; public DisplayMode vidMode; public String dimensionName; private ChunkClient emptyChunk; @@ -594,9 +564,9 @@ public class Client implements IThreadListener { private int lightUpdates = 2048; @Variable(name = "chunk_light_range", category = CVarCategory.RENDER, min = 5, max = 1024, display = "Radius Licht-Updates") private int lightRange = 32; - @Variable(name = "gl_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1) + @Variable(name = "draw_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1) public float fov = 70.0f; - @Variable(name = "gl_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus") + @Variable(name = "draw_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus") private boolean wireframe = false; @Variable(name = "con_timestamps", category = CVarCategory.CONSOLE, display = "Zeiten") @@ -623,7 +593,7 @@ public class Client implements IThreadListener { @Variable(name = "gui_scale_hotbar", category = CVarCategory.GUI, display = "Leiste vergrößern") public boolean scaleHotbar = false; @Variable(name = "hud_margin", category = CVarCategory.GUI, min = 0, max = 120, unit = "px", display = "Seitenabstand der HUD") - private int hudMargin = 8; + private int hudMargin = 4; @Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%") private float sensitivity = 1.0f; @Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms") @@ -644,7 +614,7 @@ public class Client implements IThreadListener { private boolean chatPermanent = false; @Variable(name = "overlay_opacity", category = CVarCategory.CONSOLE, min = 0x00, max = 0xff, display = "Deckkraft Hintergrund") private int hudOpacity = 0x40; - @Variable(name = "gl_vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren") + @Variable(name = "vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren") private boolean glFlush = false; @Variable(name = "con_autoclose", category = CVarCategory.CONSOLE, display = "Schließen") public boolean conAutoclose = true; @@ -709,9 +679,7 @@ public class Client implements IThreadListener { @Variable(name = "mid_visualizer", category = CVarCategory.SOUND, display = "Visualisation") public boolean midiVisualizer = true; - @Variable(name = "gl_tex_mipmaps", category = CVarCategory.RENDER, display = "Mipmaps", callback = MipmapFunction.class) - private MipmapType mipmapType = MipmapType.NONE; - @Variable(name = "gl_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden") + @Variable(name = "draw_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden") public boolean useShader = false; public static final Client CLIENT = new Client(); @@ -856,7 +824,8 @@ public class Client implements IThreadListener { this.renderItem.onReload(); this.renderer.cacheSprites(); EntityTexManager.loadNpcTextures(); - this.updateTexture(); + this.textureManager.bindTexture(TextureMap.BLOCKS); + TextureUtil.setParams(); this.renderer.loadRenderers(); this.logFeed("Texturen wurden neu geladen"); } @@ -868,7 +837,6 @@ public class Client implements IThreadListener { this.soundManager = new SoundManager(this); Log.RENDER.debug("Maximale Texturgröße: %d", GL15.glGetInteger(GL15.GL_MAX_TEXTURE_SIZE)); Log.RENDER.debug("Shader verfügbar: %s", (this.shaders = GL.getCapabilities().OpenGL20) ? "Ja (OpenGL 2.0+)" : "Nein (OpenGL 1.5)"); - Log.RENDER.debug("Mipmaps verfügbar: %s", (this.mipmaps = GL.getCapabilities().OpenGL30) ? "Ja (OpenGL 3.0+)" : "Nein (OpenGL 1.5-2.1)"); GlState.enableTexture2D(); GlState.shadeModel(GL15.GL_SMOOTH); GL15.glClearDepth(1.0D); @@ -883,7 +851,8 @@ public class Client implements IThreadListener { GL15.glMatrixMode(GL15.GL_MODELVIEW); this.textureMap = new TextureMap(); this.textureManager.loadTexture(TextureMap.BLOCKS, this.textureMap); - this.updateTexture(); + this.textureManager.bindTexture(TextureMap.BLOCKS); + TextureUtil.setParams(); this.modelManager = new ModelManager(this.textureMap); this.modelManager.onReload(); this.renderItem = new RenderItem(this.textureManager, this.modelManager); @@ -1009,7 +978,7 @@ public class Client implements IThreadListener { { this.controller.update(); } - this.textureMap.update(this.mipmaps && this.mipmapType != MipmapType.NONE); + this.textureMap.update(); if (this.open != null) { this.open.updateScreen(); @@ -1296,7 +1265,7 @@ public class Client implements IThreadListener { int color = 0x000000; float bar = -1.0f; if((this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) || this.pointedLiquid != null) { - BlockPos pos = this.pointedLiquid != null ? this.pointedLiquid : this.pointed.block; + LocalPos pos = this.pointedLiquid != null ? this.pointedLiquid : this.pointed.block; State state = this.world.getState(pos); Block block = state.getBlock(); if(this.pointedLiquid != null ? block.getMaterial().isLiquid() : block != Blocks.air) { @@ -1576,7 +1545,7 @@ public class Client implements IThreadListener { { if (leftClick && this.pointed != null && this.pointed.type == HitPosition.ObjectType.BLOCK) { - BlockPos blockpos = this.pointed.block; + LocalPos blockpos = this.pointed.block; if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.damageBlock(blockpos, this.pointed.side)) { @@ -1622,7 +1591,7 @@ public class Client implements IThreadListener { break; case BLOCK: this.player.swingItem(); - BlockPos blockpos = this.pointed.block; + LocalPos blockpos = this.pointed.block; if (this.world.getState(blockpos).getBlock() != Blocks.air) { this.controller.clickBlock(blockpos, this.pointed.side); @@ -1678,7 +1647,7 @@ public class Client implements IThreadListener { break; case BLOCK: - BlockPos blockpos = this.pointed.block; + LocalPos blockpos = this.pointed.block; if (this.world.getState(blockpos).getBlock() != Blocks.air) { @@ -1987,7 +1956,7 @@ public class Client implements IThreadListener { if(this.world == null) return mem; - BlockPos pos = new BlockPos(this.viewEntity.posX, this.viewEntity.getEntityBoundingBox().minY, this.viewEntity.posZ); + LocalPos pos = new LocalPos(this.viewEntity.posX, this.viewEntity.getEntityBoundingBox().minY, this.viewEntity.posZ); String dirStr; switch(this.viewEntity.getHorizontalFacing()) { case NORTH: @@ -2059,7 +2028,7 @@ public class Client implements IThreadListener { ; } - private String formatState(BlockPos pos, String desc) { + private String formatState(LocalPos pos, String desc) { State block = this.world.getState(pos); if(!this.debugWorld) { @@ -2390,6 +2359,8 @@ public class Client implements IThreadListener { GlState.enableBlend(); GlState.blendFunc(GL15.GL_SRC_ALPHA, GL15.GL_ONE_MINUS_SRC_ALPHA); this.initConsole(); + this.textureManager.bindTexture(TextureMap.BLOCKS); + TextureUtil.setParams(); if(this.shaders) ShaderContext.loadShaders(); this.startSound(true); @@ -3529,7 +3500,7 @@ public class Client implements IThreadListener { private void displayTick(int posX, int posY, int posZ) { int range = 16; Random rand = new Random(); - BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); + MutablePos pos = new MutablePos(); for(int n = 0; n < 1000; n++) { int x = posX + rand.zrange(range) - rand.zrange(range); int y = posY + rand.zrange(range) - rand.zrange(range); @@ -3670,7 +3641,7 @@ public class Client implements IThreadListener { int x = ExtMath.floord(this.player.posX) + this.world.rand.range(-radius, radius); int y = ExtMath.floord(this.player.posY) + this.world.rand.range(-radius, radius); int z = ExtMath.floord(this.player.posZ) + this.world.rand.range(-radius, radius); - this.world.checkBlockLight(new BlockPos(x, y, z)); + this.world.checkBlockLight(new LocalPos(x, y, z)); } } @@ -3850,11 +3821,6 @@ public class Client implements IThreadListener { public List getTiles() { return this.tiles; } - - public void updateTexture() { - this.textureManager.bindTexture(TextureMap.BLOCKS); - TextureUtil.setParams(this.mipmapType != MipmapType.NONE, this.mipmapType == MipmapType.LINEAR); - } private static byte[] genTriwave(int w, int h, int color1, int color2, int color3, int color4, int color5, int color6) { byte[] data = new byte[w * h * 4]; diff --git a/client/src/main/java/client/gui/GuiConsole.java b/client/src/main/java/client/gui/GuiConsole.java index 98a0685a..bff8da7f 100644 --- a/client/src/main/java/client/gui/GuiConsole.java +++ b/client/src/main/java/client/gui/GuiConsole.java @@ -19,7 +19,7 @@ import client.window.Keysym; import common.collect.Lists; import common.network.IPlayer; import common.packet.CPacketComplete; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.HitPosition; import common.util.Color; @@ -282,7 +282,7 @@ public class GuiConsole extends Gui implements FieldCallback { { if (currentText.length() >= 1) { - BlockPos blockpos = null; + LocalPos blockpos = null; int eid = -1; if (this.gm.pointed != null && this.gm.pointed.type == HitPosition.ObjectType.BLOCK) { @@ -291,7 +291,7 @@ public class GuiConsole extends Gui implements FieldCallback { else if (this.gm.pointed != null && this.gm.pointed.type == HitPosition.ObjectType.ENTITY) { eid = this.gm.pointed.entity.getId(); - blockpos = new BlockPos(this.gm.pointed.entity); + blockpos = new LocalPos(this.gm.pointed.entity); } if(currentText.startsWith("/")) { if(this.gm.player != null) { diff --git a/client/src/main/java/client/gui/container/GuiCrafting.java b/client/src/main/java/client/gui/container/GuiCrafting.java index cd1de422..a5c13c54 100755 --- a/client/src/main/java/client/gui/container/GuiCrafting.java +++ b/client/src/main/java/client/gui/container/GuiCrafting.java @@ -3,14 +3,14 @@ package client.gui.container; import common.block.tech.BlockWorkbench; import common.inventory.ContainerWorkbench; import common.entity.npc.EntityNPC; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class GuiCrafting extends GuiContainer { private final BlockWorkbench type; public GuiCrafting(EntityNPC inv, World world, BlockWorkbench type) { - super(new ContainerWorkbench(inv, world, BlockPos.ORIGIN, type)); + super(new ContainerWorkbench(inv, world, LocalPos.ORIGIN, type)); this.type = type; this.ySize = 36 + 18 * ((inv.getInventoryCapacity() + 11) / 12) + 18 * this.type.getSize(); } diff --git a/client/src/main/java/client/gui/ingame/GuiSign.java b/client/src/main/java/client/gui/ingame/GuiSign.java index 8c9735a4..df5d6e54 100644 --- a/client/src/main/java/client/gui/ingame/GuiSign.java +++ b/client/src/main/java/client/gui/ingame/GuiSign.java @@ -8,10 +8,10 @@ import client.gui.element.Field; import client.gui.element.FieldCallback; import client.network.ClientPlayer; import common.packet.CPacketSign; -import common.util.BlockPos; +import common.util.LocalPos; public class GuiSign extends Gui implements FieldCallback { - private final BlockPos position; + private final LocalPos position; private final Field[] lines; private final String[] tempLines; @@ -40,7 +40,7 @@ public class GuiSign extends Gui implements FieldCallback { } } - public GuiSign(BlockPos sign, String[] lines) { + public GuiSign(LocalPos sign, String[] lines) { this.position = sign; this.lines = new Field[lines.length]; this.tempLines = new String[lines.length]; diff --git a/client/src/main/java/client/gui/options/GuiBinds.java b/client/src/main/java/client/gui/options/GuiBinds.java index 9714153a..91b301d9 100644 --- a/client/src/main/java/client/gui/options/GuiBinds.java +++ b/client/src/main/java/client/gui/options/GuiBinds.java @@ -53,7 +53,7 @@ public class GuiBinds extends GuiOptions { } y += x != 0 ? 1 : 0; x = (150 * cols + 2 * (cols - 1) - 482) / 2; - this.add(new ActButton(x, 96 + y * 34, 482, 0, new ButtonCallback() { + this.add(new ActButton(x, 96 + y * 34, 240, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { boolean flag = false; for(Bind bind : Bind.values()) { @@ -65,9 +65,10 @@ public class GuiBinds extends GuiOptions { GuiBinds.this.reformat(); } } - }, "Zurücksetzen")); - this.addSelector("phy_sensitivity", x, 116 + y * 34, 240, 0); - this.addSelector("gui_dclick_delay", x + 242, 116 + y * 34, 240, 0); + }, "Tasten zurücksetzen")); + this.addSelector("phy_sensitivity", x + 242, 96 + y * 34, 240, 0); + this.addSelector("gui_dclick_delay", x, 116 + y * 34, 240, 0); + this.addSelector("gui_scroll_lines", x + 242, 116 + y * 34, 240, 0); super.init(width, height); } diff --git a/client/src/main/java/client/gui/options/GuiDisplay.java b/client/src/main/java/client/gui/options/GuiDisplay.java index 41c8e3da..00c9cb14 100644 --- a/client/src/main/java/client/gui/options/GuiDisplay.java +++ b/client/src/main/java/client/gui/options/GuiDisplay.java @@ -1,119 +1,35 @@ package client.gui.options; -import java.util.List; - -import client.Client; -import client.gui.Font; -import client.gui.Formatter; -import client.gui.element.Dropdown; -import client.gui.element.DropdownCallback; -import client.gui.element.Element; -import client.gui.element.Fill; -import client.gui.element.Slider; -import client.gui.element.SliderCallback; -import client.gui.element.Toggle; -import client.gui.element.ToggleCallback; -import client.window.Button; -import client.window.DisplayMode; -import client.window.Window; -import common.collect.Lists; -import common.util.ExtMath; -import common.util.Color; - public class GuiDisplay extends GuiOptions { - private static final String[] DISTANCES = new String[] {"Gruselig", "Winzig", "Gering", "Normal", "Weit"}; - - private Element distanceSlider; - protected GuiDisplay() { } public void init(int width, int height) { - this.add(new Toggle(0, 0, 240, 0, false, GuiDisplay.this.gm.fullscreen, new ToggleCallback() { - public void use(Toggle elem, boolean value) { - GuiDisplay.this.gm.full(value); - } - }, "Vollbild")); - int maxModes = ExtMath.clampi((height - ((3 * 20 + 2) * 2 + 18 + 4)) / Font.HEIGHT, 4, 28); - DisplayMode[] dmodes = Window.getDisplayModes(); - if(dmodes != null) { - List modes = Lists.newArrayList(); - for(int z = dmodes.length - 1; z >= 0 && modes.size() < maxModes; z--) { - DisplayMode mode = dmodes[z]; - if(mode.width() >= Client.MIN_WIDTH && mode.height() >= Client.MIN_HEIGHT) - modes.add(0, mode); - } - if(modes.isEmpty()) { - dmodes = null; - } - else { - DisplayMode selected = modes.get(modes.size() - 1); - for(DisplayMode mode : modes) { - if(mode.equals(this.gm.vidMode)) - selected = mode; - } - this.add(new Dropdown(242, 0, 240, 0, false, modes.toArray(new DisplayMode[modes.size()]), modes.get(modes.size() - 1), selected, new DropdownCallback() { - public void use(Dropdown elem, DisplayMode value) { - GuiDisplay.this.gm.vidMode = value; - GuiDisplay.this.gm.full(true); - } - }, (String)null)); - } - } - if(dmodes == null) - this.add(new Fill(242, 0, 240, 0, Color.RED + "")); + this.addSelector("overlay_enabled", 0, 0, 240, 0); + this.addSelector("overlay_opacity", 242, 0, 240, 0); + + this.addSelector("overlay_fadeout", 0, 20, 240, 0); + this.addSelector("chat_permanent", 242, 20, 240, 0); + + this.addSelector("console_size", 0, 40, 240, 0); + this.addSelector("chat_size", 242, 40, 240, 0); + + this.addSelector("feed_size", 0, 60, 240, 0); + this.addSelector("hotbar_size", 242, 60, 240, 0); + + this.addSelector("crosshair_simple", 0, 90, 240, 0); + this.addSelector("crosshair_size", 242, 90, 240, 0); - this.add(new Slider(0, 20, 240, 0, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() { - public void use(Slider elem, int value) { - GuiDisplay.this.gm.getVar("win_sync").parse("" + ((value > 0 && value < 360 - 8) ? (value + 9) : (value != 0 ? -1 : 0))); - GuiDisplay.this.gm.setDirty(); - } - }, new Formatter() { - public String use(Slider elem) { - int value = elem.getValue(); - return "Max. Bildrate: " + (value > 0 && value < (360 - 8) ? (value + 9) + " FPS" : (value != 0 ? "Unbegrenzt" : "VSync")); - } - })); - this.addSelector("gl_vsync_flush", 242, 20, 240, 0); - - this.addSelector("overlay_enabled", 0, 50, 240, 0); - this.addSelector("overlay_opacity", 242, 50, 240, 0); - - this.addSelector("overlay_fadeout", 0, 70, 240, 0); - this.addSelector("chat_permanent", 242, 70, 240, 0); - - this.addSelector("console_size", 0, 90, 240, 0); - this.addSelector("chat_size", 242, 90, 240, 0); - - this.addSelector("feed_size", 0, 110, 240, 0); - this.addSelector("hotbar_size", 242, 110, 240, 0); + this.addSelector("crosshair_color_notarget", 0, 125, 240, 0); + this.addSelector("crosshair_color_target", 242, 125, 240, 0); - this.addSelector("gl_fov", 0, 140, 240, 0); - - this.distanceSlider = this.addSelector("chunk_view_distance", 0, 160, 240, 0); - this.addSelector("chunk_build_time", 242, 160, 240, 0); - - this.addSelector("chunk_light_updates", 0, 180, 240, 0); - this.addSelector("chunk_light_range", 242, 180, 240, 0); + this.addSelector("hud_margin", 0, 145, 240, 0); + this.addSelector("gui_scale_hotbar", 242, 145, 240, 0); super.init(width, height); } public String getTitle() { - return "Grafik und Anzeige"; - } - - private String getDistanceName() { - int distance = this.gm.renderDistance; - distance = distance > 16 ? 16 : distance; - String str = distance < 0 ? DISTANCES[0] : DISTANCES[(distance + 1) / 4]; - if(distance > 2 && (((distance + 1) / 2) & 1) == 1) - str = str + "+"; - return String.format("Sichtweite: %d [%d, %s]", this.gm.renderDistance, this.gm.renderDistance * 16, str); - } - - public void updateScreen() { - if(!Button.isMouseDown()) - this.distanceSlider.setText(this.getDistanceName()); + return "Head-Up-Display"; } } diff --git a/client/src/main/java/client/gui/options/GuiGraphics.java b/client/src/main/java/client/gui/options/GuiGraphics.java index 92fbc052..4d186be1 100644 --- a/client/src/main/java/client/gui/options/GuiGraphics.java +++ b/client/src/main/java/client/gui/options/GuiGraphics.java @@ -1,42 +1,129 @@ package client.gui.options; +import java.util.List; + +import client.Client; +import client.gui.Font; +import client.gui.Formatter; +import client.gui.element.Dropdown; +import client.gui.element.DropdownCallback; import client.gui.element.Fill; +import client.gui.element.Label; +import client.gui.element.Slider; +import client.gui.element.SliderCallback; +import client.gui.element.Toggle; +import client.gui.element.ToggleCallback; +import client.window.DisplayMode; +import client.window.Window; +import common.collect.Lists; import common.util.Color; +import common.util.ExtMath; public class GuiGraphics extends GuiOptions { + private static final String[] DISTANCES = new String[] { + "Gruselig", "Winzig", "Gering", "Normal", // 0 + "Weit", "Weiter", "Sehr weit", "Noch weiter", // 16 + "Extrem", "Extremer", "Sehr extrem", "Extrem extrem", // 32 + "Überdreht", "Überdrehter", "Sehr überdreht", "GPU aufheizen", "GPU backen" // 48 + }; + + private Label distanceLabel; + private Label fovLabel; + protected GuiGraphics() { } public void init(int width, int height) { - this.addSelector("draw_downfall_range", 0, 0, 240, 0); - this.addSelector("draw_rain_particle_range", 242, 0, 240, 0); - - this.addSelector("draw_void_particles", 0, 20, 240, 0); - this.addSelector("draw_void_fog", 242, 20, 240, 0); - - this.addSelector("draw_player_firstperson", 0, 40, 240, 0); - - this.addSelector("crosshair_simple", 0, 60, 240, 0); - this.addSelector("crosshair_size", 242, 60, 240, 0); + this.add(new Toggle(0, 0, 240, 0, false, GuiGraphics.this.gm.fullscreen, new ToggleCallback() { + public void use(Toggle elem, boolean value) { + GuiGraphics.this.gm.full(value); + } + }, "Vollbild")); + int maxModes = ExtMath.clampi((height - ((3 * 20 + 2) * 2 + 18 + 4)) / Font.HEIGHT, 4, 28); + DisplayMode[] dmodes = Window.getDisplayModes(); + if(dmodes != null) { + List modes = Lists.newArrayList(); + for(int z = dmodes.length - 1; z >= 0 && modes.size() < maxModes; z--) { + DisplayMode mode = dmodes[z]; + if(mode.width() >= Client.MIN_WIDTH && mode.height() >= Client.MIN_HEIGHT) + modes.add(0, mode); + } + if(modes.isEmpty()) { + dmodes = null; + } + else { + DisplayMode selected = modes.get(modes.size() - 1); + for(DisplayMode mode : modes) { + if(mode.equals(this.gm.vidMode)) + selected = mode; + } + this.add(new Dropdown(242, 0, 240, 0, false, modes.toArray(new DisplayMode[modes.size()]), modes.get(modes.size() - 1), selected, new DropdownCallback() { + public void use(Dropdown elem, DisplayMode value) { + GuiGraphics.this.gm.vidMode = value; + GuiGraphics.this.gm.full(true); + } + }, (String)null)); + } + } + if(dmodes == null) + this.add(new Fill(242, 0, 240, 0, Color.RED + "")); - this.addSelector("crosshair_color_notarget", 0, 100, 240, 0); - this.addSelector("crosshair_color_target", 242, 100, 240, 0); + this.add(new Slider(0, 20, 240, 0, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() { + public void use(Slider elem, int value) { + GuiGraphics.this.gm.getVar("win_sync").parse("" + ((value > 0 && value < 360 - 8) ? (value + 9) : (value != 0 ? -1 : 0))); + GuiGraphics.this.gm.setDirty(); + } + }, new Formatter() { + public String use(Slider elem) { + int value = elem.getValue(); + return "Max. Bildrate: " + (value > 0 && value < (360 - 8) ? (value + 9) + " FPS" : (value != 0 ? "Unbegrenzt" : "VSync")); + } + })); + this.addSelector("vsync_flush", 242, 20, 240, 0); + + this.distanceLabel = this.add(new Label(0, 55, 240, "")); + this.addSelector("chunk_view_distance", 0, 55, 240, 0); + this.fovLabel = this.add(new Label(242, 55, 240, "")); + this.addSelector("draw_fov", 242, 55, 240, 0); + + this.addSelector("chunk_light_range", 0, 75, 240, 0); + this.addSelector("chunk_light_updates", 242, 75, 240, 0); - this.addSelector("hud_margin", 0, 140, 240, 0); + this.addSelector("chunk_build_time", 0, 95, 240, 0); + this.addSelector("draw_player_firstperson", 242, 95, 240, 0); + + this.addSelector("draw_downfall_range", 0, 115, 240, 0); + this.addSelector("draw_rain_particle_range", 242, 115, 240, 0); + + this.addSelector("draw_void_particles", 0, 135, 240, 0); + this.addSelector("draw_void_fog", 242, 135, 240, 0); if(this.gm.shaders) - this.addSelector("gl_use_shader", 0, 180, 240, 0); + this.addSelector("draw_use_shader", 0, 155, 240, 0); else - this.add(new Fill(0, 180, 240, 0, Color.RED + "Shader nicht unterstützt")); - if(this.gm.mipmaps) - this.addSelector("gl_tex_mipmaps", 242, 180, 240, 0); - else - this.add(new Fill(242, 180, 240, 0, Color.RED + "Mipmaps nicht unterstützt")); + this.add(new Fill(0, 155, 240, 0, Color.RED + "Shader nicht unterstützt")); super.init(width, height); } public String getTitle() { - return "Darstellung"; + return "Grafik und Anzeige"; + } + + private String getDistanceName() { + int distance = this.gm.renderDistance; + String str = distance < 0 ? DISTANCES[0] : DISTANCES[(distance + 1) / 4]; + if(distance > 2 && (((distance + 1) / 2) & 1) == 1) + str = str + "+"; + return String.format("%d Blöcke, %s", this.gm.renderDistance * 16, str); + } + + private String getFovName() { + return this.gm.fov < 25.0f ? "Fernglas" : (this.gm.fov > 120.0f ? "Pro-Gamer TM" : "Normal"); + } + + public void updateScreen() { + this.distanceLabel.setText(this.getDistanceName()); + this.fovLabel.setText(this.getFovName()); } } diff --git a/client/src/main/java/client/gui/options/GuiSound.java b/client/src/main/java/client/gui/options/GuiSound.java index 1751f9f6..95132a2b 100644 --- a/client/src/main/java/client/gui/options/GuiSound.java +++ b/client/src/main/java/client/gui/options/GuiSound.java @@ -10,8 +10,11 @@ public class GuiSound extends GuiOptions { } public void init(int width, int height) { + this.addSelector("mid_opl_voices", 0, 0, 240, 0); + this.addSelector("mid_opl_bank", 242, 0, 240, 0); + int x = 0; - int y = 0; + int y = 30; for(Volume volume : Volume.values()) { this.addSelector(volume.getCVarName(), x, y, 240, 0); x = (x == 0) ? 242 : 0; @@ -19,21 +22,17 @@ public class GuiSound extends GuiOptions { y += 20; } - this.addSelector("snd_enabled", 0, 50, 240, 0); + this.addSelector("snd_enabled", 0, 80, 240, 0); - this.addSelector("snd_buffer_size", 0, 70, 240, 0); - this.addSelector("snd_frame_size", 242, 70, 240, 0); + this.addSelector("snd_buffer_size", 0, 100, 240, 0); + this.addSelector("snd_frame_size", 242, 100, 240, 0); - this.add(new ActButton(0, 100, 482, 0, new ButtonCallback() { + this.add(new ActButton(0, 120, 482, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiSound.this.gm.restartSound(false); } }, "Übernehmen und Audio neu starten")); - - this.addSelector("mid_opl_voices", 0, 130, 240, 0); - this.addSelector("mid_opl_bank", 242, 130, 240, 0); - this.addSelector("mid_velocity_func", 0, 150, 240, 0); this.addSelector("mid_keep_notes", 242, 150, 240, 0); diff --git a/client/src/main/java/client/gui/options/GuiStyle.java b/client/src/main/java/client/gui/options/GuiStyle.java index e664a21f..906dec43 100644 --- a/client/src/main/java/client/gui/options/GuiStyle.java +++ b/client/src/main/java/client/gui/options/GuiStyle.java @@ -6,7 +6,6 @@ import client.gui.element.ButtonCallback; import client.gui.element.Element; import client.gui.element.Field; import client.gui.element.PressType; -import client.vars.CVar; import client.vars.ColorVar; public class GuiStyle extends GuiOptions { @@ -31,22 +30,19 @@ public class GuiStyle extends GuiOptions { protected GuiStyle() { } - protected Element addSelector(String cvar, int x, int y, int w, int h) { - CVar cv = this.gm.getVar(cvar); - if(cv instanceof ColorVar color) { - this.add(color.label(x, y, w)); - if(this.gm.style != Style.CUSTOM) - return this.add(new Field(x, y, w, h, color.getFieldValue(this.gm.style))); - else - return this.add(color.editor(x, y, w, h)); - } - return super.addSelector(cvar, x, y, w, h); + protected Element addColorSelector(String cvar, int x, int y, int w, int h) { + ColorVar color = (ColorVar)this.gm.getVar(cvar); + this.add(color.label(x, y, w)); + if(this.gm.style != Style.CUSTOM) + return this.add(new Field(x, y, w, h, color.getFieldValue(this.gm.style))); + else + return this.add(color.editor(x, y, w, h)); } public void init(int width, int height) { for(int z = 0; z < STYLE_CVARS.length; z++) { if(STYLE_CVARS[z] != null) - this.addSelector(STYLE_CVARS[z], (z / 3) * 120, (z % 3) * 34, 118, 0); + this.addColorSelector(STYLE_CVARS[z], (z / 3) * 120, (z % 3) * 34, 118, 0); } this.addSelector("gui_theme", 0, 3 * 34, 240, 0); @@ -76,8 +72,9 @@ public class GuiStyle extends GuiOptions { this.addSelector("gui_scale", 0, 3 * 34 + 20, 240, 0); this.addSelector("gui_font", 242, 3 * 34 + 20, 240, 0); + this.addSelector("gui_scale_items", 0, 3 * 34 + 40, 240, 0); - this.addSelector("gui_scale_hotbar", 242, 3 * 34 + 40, 240, 0); + super.init(width, height); } diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index 5557da84..0a3f07e9 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -128,11 +128,11 @@ import common.tileentity.Device; import common.tileentity.TileEntityDisplay; import common.tileentity.TileEntityItemPipe; import common.tileentity.TileEntitySign; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Pair; import common.util.ParticleType; -import common.util.BlockPos.MutableBlockPos; import common.util.Equipment; +import common.util.MutablePos; import common.village.MerchantRecipeList; import common.world.State; import common.world.Weather; @@ -1047,7 +1047,7 @@ public class ClientPlayer implements IClientPlayer else this.gm.world.clientParticle(ParticleType.EXPLOSION_LARGE, packetIn.getX(), packetIn.getY(), packetIn.getZ(), 100); if(packetIn.getBlocks() != null) { - for(BlockPos pos : packetIn.getBlocks()) { + for(LocalPos pos : packetIn.getBlocks()) { double d0 = (double)((float)pos.getX() + this.gm.world.rand.floatv()); double d1 = (double)((float)pos.getY() + this.gm.world.rand.floatv()); double d2 = (double)((float)pos.getZ() + this.gm.world.rand.floatv()); @@ -1371,12 +1371,12 @@ public class ClientPlayer implements IClientPlayer this.gm.effectRenderer.spawnParticle(this.gm.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, 0); } - private void playSoundAtPos(BlockPos pos, SoundEvent sound, float volume) + private void playSoundAtPos(LocalPos pos, SoundEvent sound, float volume) { this.gm.getSoundManager().playSound(new PositionedSound(sound, volume, (float)pos.getX() + 0.5f, (float)pos.getY() + 0.5f, (float)pos.getZ() + 0.5f)); } - public void playAuxSFX(int sfxType, BlockPos blockPosIn, int data) + public void playAuxSFX(int sfxType, LocalPos blockPosIn, int data) { switch (sfxType) { @@ -1461,7 +1461,7 @@ public class ClientPlayer implements IClientPlayer break; case 1025: - MutableBlockPos pos = new MutableBlockPos(blockPosIn.getX(), blockPosIn.getY(), blockPosIn.getZ()); + MutablePos pos = new MutablePos(blockPosIn.getX(), blockPosIn.getY(), blockPosIn.getZ()); for(int z = 0; z < 1000; z++) { this.spawnParticle(ParticleType.EXPLOSION_HUGE, (double)pos.getX() + this.rand.gaussian() * 128.0, (double)pos.getY() + this.rand.gaussian() * 2.0, (double)pos.getZ() + this.rand.gaussian() * 128.0); diff --git a/client/src/main/java/client/renderer/EffectRenderer.java b/client/src/main/java/client/renderer/EffectRenderer.java index 091ad541..35bb579e 100755 --- a/client/src/main/java/client/renderer/EffectRenderer.java +++ b/client/src/main/java/client/renderer/EffectRenderer.java @@ -21,7 +21,7 @@ import common.init.ItemRegistry; import common.item.Item; import common.item.consumable.ItemPotion; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Facing; import common.util.ParticleType; @@ -77,7 +77,7 @@ public class EffectRenderer { } public int getBrightness(float partial) { - BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ); + LocalPos pos = new LocalPos(this.posX, this.posY, this.posZ); return world.isBlockLoaded(pos) ? world.getCombinedBrightness(pos) : 0; } } @@ -252,7 +252,7 @@ public class EffectRenderer { return true; } - BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); + LocalPos blockpos = new LocalPos(this.posX, this.posY, this.posZ); State iblockstate = world.getState(blockpos); Block block = iblockstate.getBlock(); block.setBlockBounds(world, blockpos); @@ -1078,7 +1078,7 @@ public class EffectRenderer { } } - public void destroyBlock(BlockPos pos, State state) { + public void destroyBlock(LocalPos pos, State state) { if(state.getBlock() != Blocks.air) { state = state.getBlock().getState(state, this.world, pos); int i = 4; @@ -1096,7 +1096,7 @@ public class EffectRenderer { } } - public void damageBlock(BlockPos pos, Facing side) { + public void damageBlock(LocalPos pos, Facing side) { State iblockstate = this.world.getState(pos); Block block = iblockstate.getBlock(); diff --git a/client/src/main/java/client/renderer/ItemRenderer.java b/client/src/main/java/client/renderer/ItemRenderer.java index a996a795..7c8de971 100755 --- a/client/src/main/java/client/renderer/ItemRenderer.java +++ b/client/src/main/java/client/renderer/ItemRenderer.java @@ -20,7 +20,7 @@ import common.init.Blocks; import common.item.Item; import common.item.ItemAction; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Vec3; import common.world.State; @@ -68,12 +68,12 @@ public class ItemRenderer float f1 = 0.6F; float f2 = 0.0F; GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_POSITION, setColorBuffer( - (float)LIGHT0_POS.xCoord, (float)LIGHT0_POS.yCoord, (float)LIGHT0_POS.zCoord, 0.0f)); + (float)LIGHT0_POS.x, (float)LIGHT0_POS.y, (float)LIGHT0_POS.z, 0.0f)); GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F)); GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F)); GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_POSITION, setColorBuffer( - (float)LIGHT1_POS.xCoord, (float)LIGHT1_POS.yCoord, (float)LIGHT1_POS.zCoord, 0.0f)); + (float)LIGHT1_POS.x, (float)LIGHT1_POS.y, (float)LIGHT1_POS.z, 0.0f)); GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F)); GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F)); @@ -126,7 +126,7 @@ public class ItemRenderer private void setLightMapFromPlayer(EntityNPC clientPlayer) { - int i = this.gm.renderer.getCombinedBrightness(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ)); + int i = this.gm.renderer.getCombinedBrightness(new LocalPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ)); float f = (float)(i & 65535); float f1 = (float)(i >> 16); GL15.glMultiTexCoord2f(GL15.GL_TEXTURE1, f, f1); @@ -394,7 +394,7 @@ public class ItemRenderer if (this.gm.player.isEntityInsideOpaqueBlock()) { - State iblockstate = this.gm.world.getState(new BlockPos(this.gm.player)); + State iblockstate = this.gm.world.getState(new LocalPos(this.gm.player)); EntityNPC entityplayer = this.gm.player; for (int i = 0; i < 8; ++i) @@ -402,7 +402,7 @@ public class ItemRenderer double d0 = entityplayer.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayer.width * 0.8F); double d1 = entityplayer.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); double d2 = entityplayer.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayer.width * 0.8F); - BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayer.getEyeHeight(), d2); + LocalPos blockpos = new LocalPos(d0, d1 + (double)entityplayer.getEyeHeight(), d2); State iblockstate1 = this.gm.world.getState(blockpos); if (iblockstate1.getBlock().isVisuallyOpaque()) diff --git a/client/src/main/java/client/renderer/MatrixState.java b/client/src/main/java/client/renderer/MatrixState.java index 800a0a64..5908a248 100755 --- a/client/src/main/java/client/renderer/MatrixState.java +++ b/client/src/main/java/client/renderer/MatrixState.java @@ -11,7 +11,7 @@ import common.block.Block; import common.block.liquid.BlockLiquid; import common.entity.Entity; import common.entity.npc.EntityNPC; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Vec3; import common.world.State; @@ -58,12 +58,12 @@ public class MatrixState { double x = entity.prevX + (entity.posX - entity.prevX) * partial; double y = entity.prevY + (entity.posY - entity.prevY) * partial; double z = entity.prevZ + (entity.posZ - entity.prevZ) * partial; - return new Vec3(x + position.xCoord, y + position.yCoord, z + position.zCoord); + return new Vec3(x + position.x, y + position.y, z + position.z); } public static Block getLookedBlock(World world, Entity entity, float partial) { Vec3 view = project(entity, (double)partial); - BlockPos pos = new BlockPos(view); + LocalPos pos = new LocalPos(view); State state = world.getState(pos); Block block = state.getBlock(); if(block.getMaterial().isLiquid()) { @@ -71,7 +71,7 @@ public class MatrixState { if(state.getBlock() instanceof BlockLiquid) height = BlockLiquid.getLiquidHeightPercent(((Integer)state.getValue(BlockLiquid.LEVEL)).intValue()) - 0.11111111F; float y = (float)(pos.getY() + 1) - height; - if(view.yCoord >= (double)y) + if(view.y >= (double)y) block = world.getState(pos.up()).getBlock(); } return block; diff --git a/client/src/main/java/client/renderer/RegionRenderCache.java b/client/src/main/java/client/renderer/RegionRenderCache.java index b7c11362..b3b6c368 100755 --- a/client/src/main/java/client/renderer/RegionRenderCache.java +++ b/client/src/main/java/client/renderer/RegionRenderCache.java @@ -6,7 +6,7 @@ import client.world.ChunkClient; import client.Client; import common.init.Blocks; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Vec3i; import common.world.IWorldAccess; @@ -21,12 +21,12 @@ public class RegionRenderCache implements IWorldAccess private final int zPos; private final ChunkClient[][] chunks; private final boolean sky; - private final BlockPos position; + private final LocalPos position; private final boolean empty; private int[] combinedLights; private State[] blockStates; - public RegionRenderCache(Client world, BlockPos from, BlockPos to, int sub) + public RegionRenderCache(Client world, LocalPos from, LocalPos to, int sub) { this.sky = world.world.dimension.hasSkyLight(); this.xPos = from.getX() - sub >> 4; @@ -62,14 +62,14 @@ public class RegionRenderCache implements IWorldAccess this.blockStates = new State[16000]; } - public TileEntity getTileEntity(BlockPos pos) + public TileEntity getTileEntity(LocalPos pos) { int i = (pos.getX() >> 4) - this.xPos; int j = (pos.getZ() >> 4) - this.zPos; return this.chunks[i][j].getTileEntity(pos, TileEntity.CreateMode.QUEUED); } - public int getCombinedLight(BlockPos pos) + public int getCombinedLight(LocalPos pos) { int i = this.getPositionIndex(pos); int j = this.combinedLights[i]; @@ -83,7 +83,7 @@ public class RegionRenderCache implements IWorldAccess return j; } - public State getState(BlockPos pos) + public State getState(LocalPos pos) { int i = this.getPositionIndex(pos); State iblockstate = this.blockStates[i]; @@ -97,7 +97,7 @@ public class RegionRenderCache implements IWorldAccess return iblockstate; } - private State getBlockStateRaw(BlockPos pos) + private State getBlockStateRaw(LocalPos pos) { if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { @@ -111,7 +111,7 @@ public class RegionRenderCache implements IWorldAccess } } - private int getPositionIndex(BlockPos p_175630_1_) + private int getPositionIndex(LocalPos p_175630_1_) { int i = p_175630_1_.getX() - this.position.getX(); int j = p_175630_1_.getY() - this.position.getY(); @@ -124,7 +124,7 @@ public class RegionRenderCache implements IWorldAccess return this.empty; } - private int getBlockLightExt(BlockPos pos) + private int getBlockLightExt(LocalPos pos) { if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { @@ -169,7 +169,7 @@ public class RegionRenderCache implements IWorldAccess } } - private int getBlockLight(BlockPos pos) + private int getBlockLight(LocalPos pos) { if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { diff --git a/client/src/main/java/client/renderer/Renderer.java b/client/src/main/java/client/renderer/Renderer.java index b01eecf7..df0312a7 100755 --- a/client/src/main/java/client/renderer/Renderer.java +++ b/client/src/main/java/client/renderer/Renderer.java @@ -45,7 +45,6 @@ import common.collect.Lists; import common.collect.Maps; import common.collect.Sets; import common.dimension.DimType; -import common.dimension.Shader; import common.effect.Effect; import common.entity.Entity; import common.entity.npc.EntityCameraHolder; @@ -60,12 +59,13 @@ import common.rng.Random; import common.sound.PositionedSound; import common.sound.Sound; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.Facing; import common.util.HitPosition; import common.util.InheritanceMultiMap; +import common.util.MutablePos; import common.util.Pair; import common.util.HitPosition.ObjectType; import common.vars.Vars; @@ -119,7 +119,7 @@ public class Renderer { private final RenderManager renderManager; private final ModelManager manager; private final Set setTileEntities = Sets.newHashSet(); - private final Map mapSoundPositions = Maps.newHashMap(); + private final Map mapSoundPositions = Maps.newHashMap(); private final Map fluids = Maps.newHashMap(); private final Map dynamic = Maps.newHashMap(); @@ -308,15 +308,15 @@ public class Renderer { if (this.gm.pointed != null) { - dist = this.gm.pointed.vec.distanceTo(eye); + dist = this.gm.pointed.vec.distance(eye); } Vec3 look = entity.getLook(partialTicks); - Vec3 eyelook = eye.addVector(look.xCoord * max, look.yCoord * max, look.zCoord * max); + Vec3 eyelook = eye.add(look.x * max, look.y * max, look.z * max); this.pointedEntity = null; Vec3 hit = null; float exp = 1.0F; - List list = this.gm.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(look.xCoord * max, look.yCoord * max, look.zCoord * max).expand((double)exp, (double)exp, (double)exp), new Predicate() + List list = this.gm.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(look.x * max, look.y * max, look.z * max).expand((double)exp, (double)exp, (double)exp), new Predicate() { public boolean test(Entity p_apply_1_) { @@ -343,7 +343,7 @@ public class Renderer { } else if (objpos != null) { - double eyehit = eye.distanceTo(objpos.vec); + double eyehit = eye.distance(objpos.vec); if (eyehit < edist || edist == 0.0D) { @@ -642,7 +642,7 @@ public class Renderer { if (movingobjectposition != null) { - double d7 = movingobjectposition.vec.distanceTo(new Vec3(d0, d1, d2)); + double d7 = movingobjectposition.vec.distance(new Vec3(d0, d1, d2)); if (d7 < d3) { @@ -860,7 +860,7 @@ public class Renderer { } private Vec3 getSkyColor(Entity entity, float partial) { - BlockPos pos = new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY), + LocalPos pos = new LocalPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY), ExtMath.floord(entity.posZ)); Vec3 vec; if(this.gm.world.dimension.isExterminated()) @@ -869,11 +869,11 @@ public class Renderer { vec = new Vec3(this.gm.world.dimension.getSkyColor()); if(this.gm.world.dimension.hasDaylight()) { float mult = ExtMath.clampf(ExtMath.cos(this.getDayPhase(partial)) * 2.0F + 0.5F, 0.0F, 1.0F); - vec = new Vec3(vec.xCoord * mult, vec.yCoord * mult, vec.zCoord * mult); + vec = new Vec3(vec.x * mult, vec.y * mult, vec.z * mult); } - float r = (float)vec.xCoord; - float g = (float)vec.yCoord; - float b = (float)vec.zCoord; + float r = (float)vec.x; + float g = (float)vec.y; + float b = (float)vec.z; float rain = this.gm.world.getRainStrength(); if(rain > 0.0F) { @@ -898,9 +898,9 @@ public class Renderer { if(light > 1.0F) light = 1.0F; // light = light * 0.45F; - r = r * (1.0F - light) + (float)this.lightColor.xCoord * light; - g = g * (1.0F - light) + (float)this.lightColor.yCoord * light; - b = b * (1.0F - light) + (float)this.lightColor.zCoord * light; + r = r * (1.0F - light) + (float)this.lightColor.x * light; + g = g * (1.0F - light) + (float)this.lightColor.y * light; + b = b * (1.0F - light) + (float)this.lightColor.z * light; } float space = this.getSpaceFactor(); @@ -917,9 +917,9 @@ public class Renderer { Vec3 color = new Vec3(this.gm.world.dimension.getCloudColor()); if(this.gm.world.dimension.isExterminated()) color = new Vec3(0x000000); - float r = (float)color.xCoord; - float g = (float)color.yCoord; - float b = (float)color.zCoord; + float r = (float)color.x; + float g = (float)color.y; + float b = (float)color.z; float rain = this.gm.world.getRainStrength(); if(rain > 0.0F) { @@ -1003,9 +1003,9 @@ public class Renderer { { Vec3 lightColor = new Vec3(world.dimension.getLightColor()); float light = world.dimension.hasSkyLight() ? Math.max(sky, brightness) : 1.0f; - red = (float)lightColor.xCoord * light; - green = (float)lightColor.yCoord * light; - blue = (float)lightColor.zCoord * light; + red = (float)lightColor.x * light; + green = (float)lightColor.y * light; + blue = (float)lightColor.z * light; } if(space > 0.0f) { red = red * (1.0F - space) + space; @@ -1018,9 +1018,9 @@ public class Renderer { if(intens > 1.0F) intens = 1.0F; float light = world.dimension.hasSkyLight() ? rsky : 1.0f; - red = red * (1.0F - intens) + (float)this.lightColor.xCoord * light * intens; - green = green * (1.0F - intens) + (float)this.lightColor.yCoord * light * intens; - blue = blue * (1.0F - intens) + (float)this.lightColor.zCoord * light * intens; + red = red * (1.0F - intens) + (float)this.lightColor.x * light * intens; + green = green * (1.0F - intens) + (float)this.lightColor.y * light * intens; + blue = blue * (1.0F - intens) + (float)this.lightColor.z * light * intens; } if(block > 1.0F) @@ -1320,7 +1320,7 @@ public class Renderer { this.rng.setSeed((long)this.rendererUpdateCount * 312987231L); Entity entity = this.gm.getRenderViewEntity(); World world = this.gm.world; - BlockPos blockpos = new BlockPos(entity); + LocalPos blockpos = new LocalPos(entity); int i = this.gm.rainParticleRange; if(i <= 0) return; @@ -1344,8 +1344,8 @@ public class Renderer { for (int l = 0; l < k; ++l) { - BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.rng.zrange(i) - this.rng.zrange(i), 0, this.rng.zrange(i) - this.rng.zrange(i))); - BlockPos blockpos2 = blockpos1.down(); + LocalPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.rng.zrange(i) - this.rng.zrange(i), 0, this.rng.zrange(i) - this.rng.zrange(i))); + LocalPos blockpos2 = blockpos1.down(); Block block = world.getState(blockpos2).getBlock(); float temp = world.getTemperatureC(blockpos1); @@ -1431,7 +1431,7 @@ public class Renderer { float tic = (float)this.rendererUpdateCount + partial; buf.setTranslation(-ax, -ay, -az); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); + MutablePos pos = new MutablePos(); for(int z = ez - range; z <= ez + range; z++) { for(int x = ex - range; x <= ex + range; x++) { @@ -1540,9 +1540,9 @@ public class Renderer { Entity entity = this.gm.getRenderViewEntity(); Vec3 fog = new Vec3(world.dimension.getFogColor()); - this.fogColorRed = (float)fog.xCoord; - this.fogColorGreen = (float)fog.yCoord; - this.fogColorBlue = (float)fog.zCoord; + this.fogColorRed = (float)fog.x; + this.fogColorGreen = (float)fog.y; + this.fogColorBlue = (float)fog.z; if(world.dimension.isExterminated()) { this.fogColorRed = 0.188f; @@ -1568,7 +1568,7 @@ public class Renderer { { double neg = -1.0D; Vec3 pos = ExtMath.sin(this.getDayPhase(partial)) > 0.0F ? new Vec3(neg, 0.0D, 0.0D) : new Vec3(1.0D, 0.0D, 0.0D); - float shift = (float)entity.getLook(partial).dotProduct(pos); + float shift = (float)entity.getLook(partial).dot(pos); if (shift > 0.0F) { float[] sun = calcSunriseSunsetColors(this.getDayPhase(partial), partial); @@ -1585,9 +1585,9 @@ public class Renderer { float dist = 0.25F + 0.75F * (float)this.gm.renderDistance / 32.0F; dist = 1.0F - (float)Math.pow((double)dist, 0.25D); Vec3 sky = this.getSkyColor(this.gm.getRenderViewEntity(), partial); - this.fogColorRed += ((float)sky.xCoord - this.fogColorRed) * dist; - this.fogColorGreen += ((float)sky.yCoord - this.fogColorGreen) * dist; - this.fogColorBlue += ((float)sky.zCoord - this.fogColorBlue) * dist; + this.fogColorRed += ((float)sky.x - this.fogColorRed) * dist; + this.fogColorGreen += ((float)sky.y - this.fogColorGreen) * dist; + this.fogColorBlue += ((float)sky.z - this.fogColorBlue) * dist; float rain = world.getRainStrength(); if (rain > 0.0F) @@ -2241,7 +2241,7 @@ public class Renderer { // boolean flag3 = this.gm.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.gm.getRenderViewEntity()).isPlayerSleeping() : false; - if (entity2.posY < (double)(-World.MAX_SIZE_Y) || entity2.posY >= (double)World.MAX_SIZE_Y || this.theWorld.isBlockLoaded(new BlockPos(entity2))) + if (entity2.posY < (double)(-World.MAX_SIZE_Y) || entity2.posY >= (double)World.MAX_SIZE_Y || this.theWorld.isBlockLoaded(new LocalPos(entity2))) { if((entity2 != this.gm.getRenderViewEntity() || this.gm.thirdPersonView != 0 || this.gm.showPlayerFirstPerson)) { ++this.countEntitiesRendered; @@ -2339,9 +2339,9 @@ public class Renderer { double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks; double d5 = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks; this.initialize(d3, d4, d5); - BlockPos blockpos1 = new BlockPos(d3, d4 + (double)viewEntity.getEyeHeight(), d5); + LocalPos blockpos1 = new LocalPos(d3, d4 + (double)viewEntity.getEyeHeight(), d5); RenderChunk renderchunk = this.viewFrustum.getRenderChunk(blockpos1); - BlockPos blockpos = new BlockPos(ExtMath.floord(d3 / 16.0D) * 16, ExtMath.floord(d4 / 16.0D) * 16, ExtMath.floord(d5 / 16.0D) * 16); + LocalPos blockpos = new LocalPos(ExtMath.floord(d3 / 16.0D) * 16, ExtMath.floord(d4 / 16.0D) * 16, ExtMath.floord(d5 / 16.0D) * 16); this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || viewEntity.posX != this.lastViewEntityX || viewEntity.posY != this.lastViewEntityY || viewEntity.posZ != this.lastViewEntityZ || (double)viewEntity.rotPitch != this.lastViewEntityPitch || (double)viewEntity.rotYaw != this.lastViewEntityYaw; this.lastViewEntityX = viewEntity.posX; this.lastViewEntityY = viewEntity.posY; @@ -2401,7 +2401,7 @@ public class Renderer { { for (int i = -this.renderDistanceChunks; i <= this.renderDistanceChunks; ++i) { - RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8)); + RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new LocalPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8)); if (renderchunk1 != null && Frustum.isInFrustum(renderchunk1.boundingBox)) { @@ -2421,7 +2421,7 @@ public class Renderer { RenderInfo render1 = (RenderInfo)queue.poll(); RenderChunk chunk1 = render1.chunk; Facing face1 = this.gm.xrayActive ? null : render1.facing; - BlockPos pos1 = chunk1.getPosition(); + LocalPos pos1 = chunk1.getPosition(); this.renderInfos.add(render1); for (Facing face2 : Facing.values()) @@ -2484,7 +2484,7 @@ public class Renderer { { for (int i = -this.renderDistanceChunks; i <= this.renderDistanceChunks; ++i) { - RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8)); + RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new LocalPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8)); if (renderchunk1 != null) { @@ -2496,19 +2496,19 @@ public class Renderer { } } - private boolean isPositionInRenderChunk(BlockPos pos, RenderChunk renderChunkIn) + private boolean isPositionInRenderChunk(LocalPos pos, RenderChunk renderChunkIn) { - BlockPos blockpos = renderChunkIn.getPosition(); + LocalPos blockpos = renderChunkIn.getPosition(); return ExtMath.absi(pos.getX() - blockpos.getX()) > 16 ? false : (ExtMath.absi(pos.getY() - blockpos.getY()) > 16 ? false : ExtMath.absi(pos.getZ() - blockpos.getZ()) <= 16); } - private Set getVisibleFacings(BlockPos pos) + private Set getVisibleFacings(LocalPos pos) { VisGraph visgraph = new VisGraph(); - BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4); + LocalPos blockpos = new LocalPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4); ChunkClient chunk = this.gm.getChunk(blockpos.getX() >> 4, blockpos.getZ() >> 4); - for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos.add(15, 15, 15))) + for (MutablePos blockpos$mutableblockpos : MutablePos.mutableArea(blockpos, blockpos.add(15, 15, 15))) { if (chunk.getBlock(blockpos$mutableblockpos).isOpaqueCube()) { @@ -2522,9 +2522,9 @@ public class Renderer { * Returns RenderChunk offset from given RenderChunk in given direction, or null if it can't be seen by player at * given BlockPos. */ - private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, Facing facing) + private RenderChunk getRenderChunkOffset(LocalPos playerPos, RenderChunk renderChunkBase, Facing facing) { - BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing); + LocalPos blockpos = renderChunkBase.getBlockPosOffset16(facing); return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (ExtMath.absi(playerPos.getY() - blockpos.getY()) <= this.renderDistanceChunks * 16 ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null); } @@ -2585,7 +2585,7 @@ public class Renderer { { VertexBuffer vertexbuffer = renderchunk.getVertexBuffer(); - BlockPos blockpos = renderchunk.getPosition(); + LocalPos blockpos = renderchunk.getPosition(); context.vec("offset", (float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ)); context.matrix("model", renderchunk.getModelviewMatrix()); context.integer("chunk_x", blockpos.getX()); @@ -2697,7 +2697,7 @@ public class Renderer { private void preRenderChunk(RenderChunk renderChunkIn) { - BlockPos blockpos = renderChunkIn.getPosition(); + LocalPos blockpos = renderChunkIn.getPosition(); GL15.glTranslatef((float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ)); } @@ -2766,9 +2766,9 @@ public class Renderer { { GlState.disableTexture2D(); Vec3 vec3 = this.gm.renderer.getSkyColor(this.gm.getRenderViewEntity(), partialTicks); - float f = (float)vec3.xCoord; - float f1 = (float)vec3.yCoord; - float f2 = (float)vec3.zCoord; + float f = (float)vec3.x; + float f1 = (float)vec3.y; + float f2 = (float)vec3.z; // if (pass != 2) // { @@ -2861,8 +2861,8 @@ public class Renderer { if(color != 0xffffffff) { this.renderEngine.bindTexture((color & 0xff000000) != 0 ? EXTERMINATED_TEX : SUN_TEX); Vec3 ncolor = new Vec3(color); - float mul = Math.min(1.0f / (float)ncolor.xCoord, Math.min(1.0f / (float)ncolor.yCoord, 1.0f / (float)ncolor.zCoord)); - GlState.color((float)ncolor.xCoord * mul, (float)ncolor.yCoord * mul, (float)ncolor.zCoord * mul, f16); + float mul = Math.min(1.0f / (float)ncolor.x, Math.min(1.0f / (float)ncolor.y, 1.0f / (float)ncolor.z)); + GlState.color((float)ncolor.x * mul, (float)ncolor.y * mul, (float)ncolor.z * mul, f16); worldrenderer.begin(GL15.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos((double)(-size), 100.0D, (double)(-size)).tex(0.0D, 0.0D).endVertex(); worldrenderer.pos((double)size, 100.0D, (double)(-size)).tex(1.0D, 0.0D).endVertex(); @@ -2879,8 +2879,8 @@ public class Renderer { boolean destroyed = (colors[z] & 0xff000000) != 0; this.renderEngine.bindTexture(destroyed ? EXTERMINATED_TEX : (this.gm.world.dimension.getType() == DimType.MOON ? PLANET_TEX : MOON_TEX)); Vec3 ncolor = new Vec3(colors[z]); - float mul = Math.min(1.0f / (float)ncolor.xCoord, Math.min(1.0f / (float)ncolor.yCoord, 1.0f / (float)ncolor.zCoord)); - GlState.color((float)ncolor.xCoord * mul, (float)ncolor.yCoord * mul, (float)ncolor.zCoord * mul, f16); + float mul = Math.min(1.0f / (float)ncolor.x, Math.min(1.0f / (float)ncolor.y, 1.0f / (float)ncolor.z)); + GlState.color((float)ncolor.x * mul, (float)ncolor.y * mul, (float)ncolor.z * mul, f16); int phase = this.theWorld.getMoonPhase(z); int tx = phase % 4; int ty = phase / 4 % 2; @@ -2909,7 +2909,7 @@ public class Renderer { } else { Vec3 color = new Vec3(stars); - GlState.color((float)color.xCoord, (float)color.yCoord, (float)color.zCoord, f15); + GlState.color((float)color.x, (float)color.y, (float)color.z, f15); } // if (this.vboEnabled) @@ -2936,7 +2936,7 @@ public class Renderer { } else { Vec3 color = new Vec3(stars); - GlState.color((float)color.xCoord, (float)color.yCoord, (float)color.zCoord, f15); + GlState.color((float)color.x, (float)color.y, (float)color.z, f15); } // if (this.vboEnabled) @@ -2984,9 +2984,9 @@ public class Renderer { GlState.enableBlend(); GlState.tryBlendFuncSeparate(GL15.GL_SRC_ALPHA, GL15.GL_ONE_MINUS_SRC_ALPHA, GL15.GL_ONE, GL15.GL_ZERO); Vec3 vec3 = this.gm.renderer.getCloudColor(this.gm.getRenderViewEntity(), partialTicks); - float f4 = (float)vec3.xCoord; - float f5 = (float)vec3.yCoord; - float f6 = (float)vec3.zCoord; + float f4 = (float)vec3.x; + float f5 = (float)vec3.y; + float f6 = (float)vec3.z; // if (pass != 2) // { @@ -3158,7 +3158,7 @@ public class Renderer { GlState.disableTexture2D(); GlState.depthMask(false); float f = 0.002F; - BlockPos blockpos = movingObjectPositionIn.block; + LocalPos blockpos = movingObjectPositionIn.block; Block block = this.theWorld.getState(blockpos).getBlock(); if(block != Blocks.air) // && this.theWorld.getWorldBorder().contains(blockpos)) @@ -3301,7 +3301,7 @@ public class Renderer { GlState.enableBlend(); GlState.tryBlendFuncSeparate(GL15.GL_SRC_ALPHA, GL15.GL_ONE, GL15.GL_ONE, GL15.GL_ZERO); ItemRenderer.disableStandardItemLighting(); - GlState.color((float)stars.xCoord, (float)stars.yCoord, (float)stars.zCoord, 1.0f); + GlState.color((float)stars.x, (float)stars.y, (float)stars.z, 1.0f); this.starVBO.bindBuffer(); GL15.glEnableClientState(GL15.GL_VERTEX_ARRAY); GL15.nglVertexPointer(3, GL15.GL_FLOAT, 12, 0L); @@ -3345,7 +3345,7 @@ public class Renderer { } } - public void renderBlockEntity(State state, BlockPos brightPos) + public void renderBlockEntity(State state, LocalPos brightPos) { if (state.getBlock() != Blocks.air && !state.getBlock().getMaterial().isLiquid()) { @@ -3378,7 +3378,7 @@ public class Renderer { } } - public int getLightColor(BlockPos pos, Facing side) { + public int getLightColor(LocalPos pos, Facing side) { int light = this.getCombinedLight(pos); float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f; float shading = side == null ? 1.0f : FaceBakery.getFaceBrightness(side); @@ -3395,7 +3395,7 @@ public class Renderer { return 0xff000000 | (int)(Math.min(directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(directB, 1.0f) * 255.0f); } - public int getVertexColor(BlockPos pos, Facing side, int light, boolean flip) { + public int getVertexColor(LocalPos pos, Facing side, int light, boolean flip) { float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f; float shading = side == null ? 1.0f : FaceBakery.getFaceBrightness(side); float max = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f; @@ -3406,7 +3406,7 @@ public class Renderer { return 0xff000000 | (int)(Math.min(flip ? directB : directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(flip ? directR : directB, 1.0f) * 255.0f); } - public int getSkyBrightness(BlockPos pos) { + public int getSkyBrightness(LocalPos pos) { int light = this.getCombinedLight(pos); float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f; float block = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f; @@ -3414,13 +3414,13 @@ public class Renderer { return ((int)(sky * 255.0f) / 16) << 20 | ((int)(block * 255.0f) / 16) << 4; } - public int getCombinedBrightness(BlockPos pos) { + public int getCombinedBrightness(LocalPos pos) { int light = this.getLightColor(pos, null); light = Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 16; return light << 20 | light << 4; } - public boolean renderBlock(State state, BlockPos pos, IWorldAccess world, RenderBuffer rb) { + public boolean renderBlock(State state, LocalPos pos, IWorldAccess world, RenderBuffer rb) { Block block = state.getBlock(); if(this.gm.xrayActive && !block.isXrayVisible()) return false; @@ -3446,7 +3446,7 @@ public class Renderer { for(Facing side : Facing.values()) { List list = model.getFace(side); if(!list.isEmpty()) { - BlockPos bpos = pos.offset(side); + LocalPos bpos = pos.offset(side); if(!checkSides || block.canRender(world, bpos, side)) { int light = this.getLightmapValue(world, bpos, side); int sky = this.getSkyBrightness(bpos); @@ -3467,7 +3467,7 @@ public class Renderer { return Math.max((lightA >> 16) & 0xff, (lightB >> 16) & 0xff) << 16 | Math.max((lightA >> 8) & 0xff, (lightB >> 8) & 0xff) << 8 | Math.max(lightA & 0xff, lightB & 0xff); } - private int getLightmapValue(IWorldAccess world, BlockPos pos, Facing side) { + private int getLightmapValue(IWorldAccess world, LocalPos pos, Facing side) { Block block = world.getState(pos).getBlock(); int light = componentMax(world.getCombinedLight(pos), block.getLight()); if(light == 0 && block instanceof BlockSlab) { @@ -3478,13 +3478,13 @@ public class Renderer { return getVertexColor(pos, side, light, true); } - private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos, Facing side) { + private int getLightmapValueLiquid(IWorldAccess world, LocalPos pos, Facing side) { int light = world.getCombinedLight(pos); int up = world.getCombinedLight(pos.up()); return getVertexColor(pos, side, componentMax(light, up), false); } - private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, int sky, boolean ownLight, RenderBuffer worldRendererIn, List listQuadsIn, BitSet boundsFlags) + private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, LocalPos blockPosIn, Facing faceIn, int light, int sky, boolean ownLight, RenderBuffer worldRendererIn, List listQuadsIn, BitSet boundsFlags) { double d0 = (double)blockPosIn.getX(); double d1 = (double)blockPosIn.getY(); @@ -3580,7 +3580,7 @@ public class Renderer { } } - private boolean renderFluid(IWorldAccess blockAccess, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn) + private boolean renderFluid(IWorldAccess blockAccess, State blockStateIn, LocalPos blockPosIn, RenderBuffer worldRendererIn) { BlockLiquid blockliquid = (BlockLiquid)blockStateIn.getBlock(); blockliquid.setBlockBounds(blockAccess, blockPosIn); @@ -3711,7 +3711,7 @@ public class Renderer { ++j1; } - BlockPos blockpos = blockPosIn.add(j1, 0, k1); + LocalPos blockpos = blockPosIn.add(j1, 0, k1); Sprite textureatlassprite1 = atextureatlassprite[1]; if (aboolean[np]) @@ -3783,14 +3783,14 @@ public class Renderer { } } - private float getFluidHeight(IBlockAccess blockAccess, BlockPos blockPosIn) + private float getFluidHeight(IBlockAccess blockAccess, LocalPos blockPosIn) { int i = 0; float f = 0.0F; for (int j = 0; j < 4; ++j) { - BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1)); + LocalPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1)); if (blockAccess.getState(blockpos.up()).getBlock().getMaterial().isLiquid()) { @@ -3826,7 +3826,7 @@ public class Renderer { return 1.0F - f / (float)i; } - private boolean renderDynamic(IWorldAccess blockAccess, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn) + private boolean renderDynamic(IWorldAccess blockAccess, State blockStateIn, LocalPos blockPosIn, RenderBuffer worldRendererIn) { Block block = blockStateIn.getBlock(); block.setBlockBounds(blockAccess, blockPosIn); @@ -3933,7 +3933,7 @@ public class Renderer { ++j1; } - BlockPos blockpos = blockPosIn.add(j1, 0, k1); + LocalPos blockpos = blockPosIn.add(j1, 0, k1); Sprite textureatlassprite1 = textureatlassprite; if (aboolean[np]) @@ -4005,7 +4005,7 @@ public class Renderer { } } - private float getAdjacentHeight(IBlockAccess blockAccess, BlockPos blockPosIn, Block block) + private float getAdjacentHeight(IBlockAccess blockAccess, LocalPos blockPosIn, Block block) { int i = 0; float f = 0.0F; @@ -4015,7 +4015,7 @@ public class Renderer { for (int j = 0; j < 4; ++j) { - BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1)); + LocalPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1)); if (blockAccess.getState(blockpos.up()).getBlock() != Blocks.air) { @@ -4052,9 +4052,9 @@ public class Renderer { return n == 4 ? 1.0f : (s + a == 4 && a > 1 ? 0.0f : 1.0F - f / (float)i); } - private int getLight(BlockPos pos) { + private int getLight(LocalPos pos) { if(pos.getY() < -World.MAX_SIZE_Y) { - pos = new BlockPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ()); + pos = new LocalPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ()); } if(!World.isValid(pos)) { @@ -4066,9 +4066,9 @@ public class Renderer { } } - public int getCombinedLight(BlockPos pos) { + public int getCombinedLight(LocalPos pos) { if(pos.getY() < -World.MAX_SIZE_Y) { - pos = new BlockPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ()); + pos = new LocalPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ()); } if(!World.isValid(pos) || this.gm.world == null) { @@ -4127,7 +4127,7 @@ public class Renderer { // } // } - private int getRawBlockLight(BlockPos pos, int component) { + private int getRawBlockLight(LocalPos pos, int component) { Block block = this.gm.world.getState(pos).getBlock(); int light = ((block.getLight() >> ((2 - component) * 8)) & 0xff) / 16; int opacity = block.getLightOpacity(); @@ -4148,7 +4148,7 @@ public class Renderer { } else { for(Facing side : Facing.values()) { - BlockPos bpos = pos.offset(side); + LocalPos bpos = pos.offset(side); int blight = this.getLightFor(bpos, component) - opacity; if(blight > light) { @@ -4164,11 +4164,11 @@ public class Renderer { } } - private int getLightFor(BlockPos pos, int component) { + private int getLightFor(LocalPos pos, int component) { return ((this.getLight(pos) >> ((2 - component) * 8)) & 0xff) / 16; } - private void setBlockLight(BlockPos pos, int component, int value) { + private void setBlockLight(LocalPos pos, int component, int value) { if(World.isValid(pos)) { ChunkClient chunk = this.gm.getChunk(pos.getX() >> 4, pos.getZ() >> 4); int light = chunk.getLight(pos); @@ -4180,7 +4180,7 @@ public class Renderer { } } - public boolean checkBlockLight(BlockPos pos) { + public boolean checkBlockLight(LocalPos pos) { if(!this.gm.world.isAreaLoaded(pos, 17, false)) return false; for(int component = 0; component < 3; component++) { @@ -4204,7 +4204,7 @@ public class Renderer { int y = (p >> 6 & 63) - 32 + by; int z = (p >> 12 & 63) - 32 + bz; int s = p >> 18 & 15; - BlockPos blk = new BlockPos(x, y, z); + LocalPos blk = new LocalPos(x, y, z); int l = this.getLightFor(blk, component); if(l == s) { @@ -4216,7 +4216,7 @@ public class Renderer { int dz = ExtMath.absi(z - bz); if(dx + dy + dz < 17) { - BlockPos.MutableBlockPos bpos = new BlockPos.MutableBlockPos(); + MutablePos bpos = new MutablePos(); for(Facing dir : Facing.values()) { int ox = x + dir.getFrontOffsetX(); @@ -4243,7 +4243,7 @@ public class Renderer { int x = (p & 63) - 32 + bx; int y = (p >> 6 & 63) - 32 + by; int z = (p >> 12 & 63) - 32 + bz; - BlockPos blk = new BlockPos(x, y, z); + LocalPos blk = new LocalPos(x, y, z); int l = this.getLightFor(blk, component); int r = this.getRawBlockLight(blk, component); diff --git a/client/src/main/java/client/renderer/ShaderContext.java b/client/src/main/java/client/renderer/ShaderContext.java index 0eee17d1..f810bec1 100644 --- a/client/src/main/java/client/renderer/ShaderContext.java +++ b/client/src/main/java/client/renderer/ShaderContext.java @@ -203,7 +203,7 @@ public class ShaderContext { } public ShaderContext vec(String name, Vec3 vec) { - GL20.glUniform3f(GL20.glGetUniformLocation(this.program, name), (float)vec.xCoord, (float)vec.yCoord, (float)vec.zCoord); + GL20.glUniform3f(GL20.glGetUniformLocation(this.program, name), (float)vec.x, (float)vec.y, (float)vec.z); return this; } diff --git a/client/src/main/java/client/renderer/ViewFrustum.java b/client/src/main/java/client/renderer/ViewFrustum.java index 3971db0e..f88c0c1a 100755 --- a/client/src/main/java/client/renderer/ViewFrustum.java +++ b/client/src/main/java/client/renderer/ViewFrustum.java @@ -2,7 +2,7 @@ package client.renderer; import client.renderer.chunk.RenderChunk; import client.Client; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; public class ViewFrustum @@ -39,7 +39,7 @@ public class ViewFrustum for (int i1 = 0; i1 < this.countChunksZ; ++i1) { int j1 = (i1 * this.countChunksY + l) * this.countChunksX + k; - BlockPos blockpos = new BlockPos(k * 16, l * 16, i1 * 16); + LocalPos blockpos = new LocalPos(k * 16, l * 16, i1 * 16); this.renderChunks[j1] = new RenderChunk(this.gm, this.renderGlobal, blockpos, j++); } } @@ -81,7 +81,7 @@ public class ViewFrustum { int i2 = this.func_178157_a(n, k, l1); RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l]; - BlockPos blockpos = new BlockPos(i1, i2, k1); + LocalPos blockpos = new LocalPos(i1, i2, k1); if (!blockpos.equals(renderchunk.getPosition())) { @@ -149,7 +149,7 @@ public class ViewFrustum } } - protected RenderChunk getRenderChunk(BlockPos pos) + protected RenderChunk getRenderChunk(LocalPos pos) { int x = bucketInt(pos.getX()); int y = bucketInt(pos.getY()); diff --git a/client/src/main/java/client/renderer/chunk/RenderChunk.java b/client/src/main/java/client/renderer/chunk/RenderChunk.java index d99b0796..44473829 100755 --- a/client/src/main/java/client/renderer/chunk/RenderChunk.java +++ b/client/src/main/java/client/renderer/chunk/RenderChunk.java @@ -24,9 +24,10 @@ import common.collect.Maps; import common.collect.Sets; import common.init.Blocks; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; +import common.util.MutablePos; import common.world.State; public class RenderChunk @@ -34,7 +35,7 @@ public class RenderChunk private Client gm; private final Renderer renderGlobal; public static int renderChunksUpdated; - private BlockPos position; + private LocalPos position; public CompiledChunk compiledChunk = CompiledChunk.DUMMY; private final ReentrantLock lockCompileTask = new ReentrantLock(); private final ReentrantLock lockCompiledChunk = new ReentrantLock(); @@ -46,9 +47,9 @@ public class RenderChunk public BoundingBox boundingBox; private int frameIndex = -1; private boolean needsUpdate = true; - private EnumMap mapEnumFacing = Maps.newEnumMap(Facing.class); + private EnumMap mapEnumFacing = Maps.newEnumMap(Facing.class); - public RenderChunk(Client worldIn, Renderer renderGlobalIn, BlockPos blockPosIn, int indexIn) + public RenderChunk(Client worldIn, Renderer renderGlobalIn, LocalPos blockPosIn, int indexIn) { this.gm = worldIn; this.renderGlobal = renderGlobalIn; @@ -80,7 +81,7 @@ public class RenderChunk return this.vertexBuffer; } - public void setPosition(BlockPos pos) + public void setPosition(LocalPos pos) { this.stopCompileTask(); this.position = pos; @@ -98,8 +99,8 @@ public class RenderChunk { CompiledChunk compiledchunk = new CompiledChunk(); int i = 1; - BlockPos blockpos = this.position; - BlockPos blockpos1 = blockpos.add(15, 15, 15); + LocalPos blockpos = this.position; + LocalPos blockpos1 = blockpos.add(15, 15, 15); generator.getLock().lock(); RegionRenderCache iblockaccess; @@ -127,7 +128,7 @@ public class RenderChunk boolean aboolean = false; Renderer renderer = this.gm.renderer; - for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos1)) + for (MutablePos blockpos$mutableblockpos : MutablePos.mutableArea(blockpos, blockpos1)) { State iblockstate = iblockaccess.getState(blockpos$mutableblockpos); Block block = iblockstate.getBlock(); @@ -139,7 +140,7 @@ public class RenderChunk if (block instanceof ITileEntityProvider) { - TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); + TileEntity tileentity = iblockaccess.getTileEntity(new LocalPos(blockpos$mutableblockpos)); ElementRenderer tileentityspecialrenderer = SpecialRenderer.instance.getRenderer(tileentity); if (tileentity != null && tileentityspecialrenderer != null) @@ -239,7 +240,7 @@ public class RenderChunk return chunkcompiletaskgenerator; } - private void preRenderBlocks(RenderBuffer worldRendererIn, BlockPos pos) + private void preRenderBlocks(RenderBuffer worldRendererIn, LocalPos pos) { worldRendererIn.begin(GL15.GL_QUADS, DefaultVertexFormats.BLOCK); worldRendererIn.setTranslation((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); @@ -295,7 +296,7 @@ public class RenderChunk this.vertexBuffer.deleteGlBuffers(); } - public BlockPos getPosition() + public LocalPos getPosition() { return this.position; } @@ -310,8 +311,8 @@ public class RenderChunk return this.needsUpdate; } - public BlockPos getBlockPosOffset16(Facing p_181701_1_) + public LocalPos getBlockPosOffset16(Facing p_181701_1_) { - return (BlockPos)this.mapEnumFacing.get(p_181701_1_); + return (LocalPos)this.mapEnumFacing.get(p_181701_1_); } } diff --git a/client/src/main/java/client/renderer/chunk/VisGraph.java b/client/src/main/java/client/renderer/chunk/VisGraph.java index ebca265d..ac3da4ae 100755 --- a/client/src/main/java/client/renderer/chunk/VisGraph.java +++ b/client/src/main/java/client/renderer/chunk/VisGraph.java @@ -6,7 +6,7 @@ import java.util.LinkedList; import java.util.Queue; import java.util.Set; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; public class VisGraph @@ -26,13 +26,13 @@ public class VisGraph } } - public void func_178606_a(BlockPos pos) + public void func_178606_a(LocalPos pos) { this.field_178612_d.set(getIndex(pos), true); --this.field_178611_f; } - private static int getIndex(BlockPos pos) + private static int getIndex(LocalPos pos) { return getIndex(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15); } @@ -68,7 +68,7 @@ public class VisGraph return setvisibility; } - public Set func_178609_b(BlockPos pos) + public Set func_178609_b(LocalPos pos) { return this.func_178604_a(getIndex(pos)); } diff --git a/client/src/main/java/client/renderer/entity/RenderBlockEntity.java b/client/src/main/java/client/renderer/entity/RenderBlockEntity.java index 143a95f0..fc49ec7d 100755 --- a/client/src/main/java/client/renderer/entity/RenderBlockEntity.java +++ b/client/src/main/java/client/renderer/entity/RenderBlockEntity.java @@ -5,7 +5,7 @@ import org.lwjgl.opengl.GL15; import client.Client; import client.renderer.texture.TextureMap; import common.entity.Entity; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; @@ -25,7 +25,7 @@ public class RenderBlockEntity extends Render GL15.glTranslatef((float)x, (float)y + 0.5F, (float)z); this.bindEntityTexture(entity); GL15.glTranslatef(-0.5F, -0.5F, 0.5F); - Client.CLIENT.renderer.renderBlockEntity(this.state, new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ)); + Client.CLIENT.renderer.renderBlockEntity(this.state, new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ)); GL15.glTranslatef(0.0F, 0.0F, 1.0F); GL15.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); diff --git a/client/src/main/java/client/renderer/entity/RenderFallingBlock.java b/client/src/main/java/client/renderer/entity/RenderFallingBlock.java index 0a54101a..a1bae2f0 100755 --- a/client/src/main/java/client/renderer/entity/RenderFallingBlock.java +++ b/client/src/main/java/client/renderer/entity/RenderFallingBlock.java @@ -7,7 +7,7 @@ import client.renderer.texture.TextureMap; import common.block.Block; import common.entity.item.EntityFalling; import common.init.Blocks; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import common.world.World; @@ -20,7 +20,7 @@ public class RenderFallingBlock extends Render { if(entity.getBlock() != null) { State state = entity.getBlock(); Block block = state.getBlock(); - BlockPos pos = new BlockPos(entity); + LocalPos pos = new LocalPos(entity); World world = entity.getWorldObj(); if(state != world.getState(pos) && block != Blocks.air && !block.getMaterial().isLiquid()) { @@ -29,7 +29,7 @@ public class RenderFallingBlock extends Render { GL15.glTranslatef((float)x, (float)y + 0.5F, (float)z); this.bindEntityTexture(entity); GL15.glTranslatef(-0.5F, -0.5F, 0.5F); - Client.CLIENT.renderer.renderBlockEntity(state, new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ)); + Client.CLIENT.renderer.renderBlockEntity(state, new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ)); GL15.glTranslatef(0.0F, 0.0F, 1.0F); GL15.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); diff --git a/client/src/main/java/client/renderer/entity/RenderFish.java b/client/src/main/java/client/renderer/entity/RenderFish.java index fd6ea03a..573c7b8c 100755 --- a/client/src/main/java/client/renderer/entity/RenderFish.java +++ b/client/src/main/java/client/renderer/entity/RenderFish.java @@ -57,13 +57,13 @@ public class RenderFish extends Render float f7 = entity.angler.getSwingProgress(partialTicks); float f8 = ExtMath.sin(ExtMath.sqrtf(f7) * (float)Math.PI); Vec3 vec3 = new Vec3(-0.36D, 0.03D, 0.35D); - vec3 = vec3.rotatePitch(-(entity.angler.prevPitch + (entity.angler.rotPitch - entity.angler.prevPitch) * partialTicks) * (float)Math.PI / 180.0F); - vec3 = vec3.rotateYaw(-(entity.angler.prevYaw + (entity.angler.rotYaw - entity.angler.prevYaw) * partialTicks) * (float)Math.PI / 180.0F); - vec3 = vec3.rotateYaw(f8 * 0.5F); - vec3 = vec3.rotatePitch(-f8 * 0.7F); - double d0 = entity.angler.prevX + (entity.angler.posX - entity.angler.prevX) * (double)partialTicks + vec3.xCoord; - double d1 = entity.angler.prevY + (entity.angler.posY - entity.angler.prevY) * (double)partialTicks + vec3.yCoord; - double d2 = entity.angler.prevZ + (entity.angler.posZ - entity.angler.prevZ) * (double)partialTicks + vec3.zCoord; + vec3 = vec3.pitch(-(entity.angler.prevPitch + (entity.angler.rotPitch - entity.angler.prevPitch) * partialTicks) * (float)Math.PI / 180.0F); + vec3 = vec3.yaw(-(entity.angler.prevYaw + (entity.angler.rotYaw - entity.angler.prevYaw) * partialTicks) * (float)Math.PI / 180.0F); + vec3 = vec3.yaw(f8 * 0.5F); + vec3 = vec3.pitch(-f8 * 0.7F); + double d0 = entity.angler.prevX + (entity.angler.posX - entity.angler.prevX) * (double)partialTicks + vec3.x; + double d1 = entity.angler.prevY + (entity.angler.posY - entity.angler.prevY) * (double)partialTicks + vec3.y; + double d2 = entity.angler.prevZ + (entity.angler.posZ - entity.angler.prevZ) * (double)partialTicks + vec3.z; double d3 = (double)entity.angler.getEyeHeight(); if (this.manager.gm != null && this.manager.gm.thirdPersonView > 0 || entity.angler != Client.CLIENT.player || this.manager.gm != null && this.manager.gm.showPlayerFirstPerson) diff --git a/client/src/main/java/client/renderer/entity/RenderManager.java b/client/src/main/java/client/renderer/entity/RenderManager.java index 2c10cf26..55290c04 100755 --- a/client/src/main/java/client/renderer/entity/RenderManager.java +++ b/client/src/main/java/client/renderer/entity/RenderManager.java @@ -19,7 +19,7 @@ import common.collect.Maps; import common.entity.Entity; import common.entity.types.EntityLiving; import common.init.SpeciesRegistry.ModelType; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Vec3; import common.world.World; @@ -120,7 +120,7 @@ public class RenderManager { } public static int getBrightnessForRender(Entity entity) { - BlockPos pos = new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ); + LocalPos pos = new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ); return entity.worldObj.isBlockLoaded(pos) ? entity.worldObj.getCombinedBrightness(pos) : 0; } @@ -271,7 +271,7 @@ public class RenderManager { Vec3 vec3 = entityIn.getLook(partialTicks); worldrenderer.begin(GL15.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex(); - worldrenderer.pos(x + vec3.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3.yCoord * 2.0D, z + vec3.zCoord * 2.0D).color(0, 0, 255, 255).endVertex(); + worldrenderer.pos(x + vec3.x * 2.0D, y + (double)entityIn.getEyeHeight() + vec3.y * 2.0D, z + vec3.z * 2.0D).color(0, 0, 255, 255).endVertex(); Tessellator.draw(); GlState.enableTexture2D(); GlState.enableLighting(); diff --git a/client/src/main/java/client/renderer/entity/RenderMinecart.java b/client/src/main/java/client/renderer/entity/RenderMinecart.java index 369261de..de24244a 100755 --- a/client/src/main/java/client/renderer/entity/RenderMinecart.java +++ b/client/src/main/java/client/renderer/entity/RenderMinecart.java @@ -9,7 +9,7 @@ import client.renderer.model.ModelMinecart; import client.renderer.texture.TextureMap; import common.entity.item.EntityCart; import common.init.Blocks; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Vec3; import common.world.State; @@ -63,16 +63,16 @@ public class RenderMinecart extends Render vec32 = vec3; } - x += vec3.xCoord - d0; - y += (vec31.yCoord + vec32.yCoord) / 2.0D - d1; - z += vec3.zCoord - d2; - Vec3 vec33 = vec32.addVector(-vec31.xCoord, -vec31.yCoord, -vec31.zCoord); + x += vec3.x - d0; + y += (vec31.y + vec32.y) / 2.0D - d1; + z += vec3.z - d2; + Vec3 vec33 = vec32.add(-vec31.x, -vec31.y, -vec31.z); - if (vec33.lengthVector() != 0.0D) + if (vec33.length() != 0.0D) { vec33 = vec33.normalize(); - entityYaw = (float)(Math.atan2(vec33.zCoord, vec33.xCoord) * 180.0D / Math.PI); - f3 = (float)(Math.atan(vec33.yCoord) * 73.0D); + entityYaw = (float)(Math.atan2(vec33.z, vec33.x) * 180.0D / Math.PI); + f3 = (float)(Math.atan(vec33.y) * 73.0D); } } @@ -125,7 +125,7 @@ public class RenderMinecart extends Render protected void func_180560_a(T minecart, float partialTicks, State state) { GL15.glPushMatrix(); - Client.CLIENT.renderer.renderBlockEntity(state, new BlockPos(minecart.posX, minecart.posY + (double)minecart.getEyeHeight(), minecart.posZ)); + Client.CLIENT.renderer.renderBlockEntity(state, new LocalPos(minecart.posX, minecart.posY + (double)minecart.getEyeHeight(), minecart.posZ)); GL15.glPopMatrix(); } } diff --git a/client/src/main/java/client/renderer/entity/RenderTntPrimed.java b/client/src/main/java/client/renderer/entity/RenderTntPrimed.java index fa696815..28ba1a16 100755 --- a/client/src/main/java/client/renderer/entity/RenderTntPrimed.java +++ b/client/src/main/java/client/renderer/entity/RenderTntPrimed.java @@ -9,7 +9,7 @@ import client.renderer.texture.TextureMap; import common.block.Block; import common.entity.item.EntityTnt; import common.init.BlockRegistry; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; @@ -40,7 +40,7 @@ public class RenderTntPrimed extends Render this.bindEntityTexture(entity); GL15.glTranslatef(-0.5F, -0.5F, 0.5F); Block tnt = BlockRegistry.byName("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize)); - renderer.renderBlockEntity(tnt.getState(), new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ)); + renderer.renderBlockEntity(tnt.getState(), new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ)); GL15.glTranslatef(0.0F, 0.0F, 1.0F); if (entity.fuse / 5 % 2 == 0) diff --git a/client/src/main/java/client/renderer/layers/LayerArmor.java b/client/src/main/java/client/renderer/layers/LayerArmor.java index b7675acd..8f70613b 100755 --- a/client/src/main/java/client/renderer/layers/LayerArmor.java +++ b/client/src/main/java/client/renderer/layers/LayerArmor.java @@ -2,8 +2,6 @@ package client.renderer.layers; import java.util.List; -import org.lwjgl.opengl.GL15; - import client.Client; import client.renderer.GlState; import client.renderer.entity.RendererLivingEntity; @@ -12,7 +10,6 @@ import common.collect.Lists; import common.enchantment.Enchantment; import common.enchantment.EnchantmentHelper; import common.entity.npc.EntityNPC; -import common.entity.types.EntityLiving; import common.item.ItemStack; import common.item.material.ItemArmor; import common.util.Equipment; diff --git a/client/src/main/java/client/renderer/model/TexturedQuad.java b/client/src/main/java/client/renderer/model/TexturedQuad.java index 7e66aba2..0e11bfc5 100755 --- a/client/src/main/java/client/renderer/model/TexturedQuad.java +++ b/client/src/main/java/client/renderer/model/TexturedQuad.java @@ -47,12 +47,12 @@ public class TexturedQuad public void addTo(RenderBuffer renderer, float scale) { - Vec3 norma = this.vertices[1].pos.subtractReverse(this.vertices[0].pos); - Vec3 normb = this.vertices[1].pos.subtractReverse(this.vertices[2].pos); - Vec3 norm = normb.crossProduct(norma).normalize(); - float nx = (float)norm.xCoord; - float ny = (float)norm.yCoord; - float nz = (float)norm.zCoord; + Vec3 norma = this.vertices[1].pos.subtractRev(this.vertices[0].pos); + Vec3 normb = this.vertices[1].pos.subtractRev(this.vertices[2].pos); + Vec3 norm = normb.cross(norma).normalize(); + float nx = (float)norm.x; + float ny = (float)norm.y; + float nz = (float)norm.z; // if (this.invNorm) // { // nx = -nx; @@ -63,7 +63,7 @@ public class TexturedQuad for (int i = 0; i < 4; ++i) { PositionTextureVertex vertex = this.vertices[i]; - renderer.pos(vertex.pos.xCoord * (double)scale, vertex.pos.yCoord * (double)scale, vertex.pos.zCoord * (double)scale) + renderer.pos(vertex.pos.x * (double)scale, vertex.pos.y * (double)scale, vertex.pos.z * (double)scale) .tex((double)vertex.texX, (double)vertex.texY).normal(nx, ny, nz).endVertex(); } // Tessellator.getInstance(); diff --git a/client/src/main/java/client/renderer/texture/TextureMap.java b/client/src/main/java/client/renderer/texture/TextureMap.java index 62816140..ad30ef53 100755 --- a/client/src/main/java/client/renderer/texture/TextureMap.java +++ b/client/src/main/java/client/renderer/texture/TextureMap.java @@ -7,9 +7,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.lwjgl.opengl.GL15; -import org.lwjgl.opengl.GL30; - import java.util.Map.Entry; import client.init.RenderRegistry; @@ -193,7 +190,7 @@ public class TextureMap extends Texture return textureatlassprite; } - public void update(boolean mips) + public void update() { GlState.bindTexture(this.getGlTextureId()); @@ -201,9 +198,6 @@ public class TextureMap extends Texture { textureatlassprite.updateAnimation(); } - - if(mips) - GL30.glGenerateMipmap(GL15.GL_TEXTURE_2D); } private Sprite registerSprite(String location) diff --git a/client/src/main/java/client/renderer/texture/TextureUtil.java b/client/src/main/java/client/renderer/texture/TextureUtil.java index 409cda5c..bce974f7 100755 --- a/client/src/main/java/client/renderer/texture/TextureUtil.java +++ b/client/src/main/java/client/renderer/texture/TextureUtil.java @@ -22,8 +22,8 @@ public class TextureUtil public static final DynamicTexture MISSING = new DynamicTexture(16, 16); public static final int[] MISSING_DATA = MISSING.getData(); - public static void setParams(boolean mips, boolean linear) { - GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MIN_FILTER, mips ? (linear ? GL15.GL_NEAREST_MIPMAP_LINEAR : GL15.GL_NEAREST_MIPMAP_NEAREST) : GL15.GL_NEAREST); + public static void setParams() { + GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MIN_FILTER, GL15.GL_NEAREST); GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MAG_FILTER, GL15.GL_NEAREST); GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_WRAP_S, GL15.GL_REPEAT); GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_WRAP_T, GL15.GL_REPEAT); @@ -33,7 +33,7 @@ public class TextureUtil { int i = 4194304 / w; if(params) - setParams(false, false); + setParams(); int l; for (int j = 0; j < w * h; j += w * l) @@ -56,7 +56,7 @@ public class TextureUtil int h = img.getHeight(); int k = 4194304 / w; int[] data = new int[k * w]; - setParams(false, false); + setParams(); for (int l = 0; l < w * h; l += w * k) { diff --git a/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java b/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java index 2f92b111..74b2244f 100644 --- a/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java @@ -13,7 +13,7 @@ import common.block.Block; import common.block.tech.BlockDisplay; import common.collect.Maps; import common.tileentity.TileEntityDisplay; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; @@ -26,7 +26,7 @@ public class DisplayRenderer extends ElementRenderer { private static final Map DISPLAYS = Maps.newHashMap(); - private static String getTextureLocation(BlockPos pos) { + private static String getTextureLocation(LocalPos pos) { return "display/" + pos.getX() + "," + pos.getY() + "," + pos.getZ(); } diff --git a/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java b/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java index 034419b3..34924612 100755 --- a/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java @@ -11,7 +11,7 @@ import common.tileentity.TileEntity; import common.tileentity.TileEntityDisplay; import common.tileentity.TileEntityItemPipe; import common.tileentity.TileEntitySign; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class SpecialRenderer { @@ -60,7 +60,7 @@ public class SpecialRenderer { int sky = light / 65536; GL15.glMultiTexCoord2f(GL15.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - BlockPos pos = tile.getPos(); + LocalPos pos = tile.getPos(); this.render(tile, (double)pos.getX() - entityX, (double)pos.getY() - entityY, (double)pos.getZ() - entityZ, partial); } } diff --git a/client/src/main/java/client/util/PlayerController.java b/client/src/main/java/client/util/PlayerController.java index 67078da3..0992062f 100755 --- a/client/src/main/java/client/util/PlayerController.java +++ b/client/src/main/java/client/util/PlayerController.java @@ -15,7 +15,7 @@ import common.packet.CPacketBreak; import common.packet.CPacketClick; import common.packet.CPacketPlace; import common.sound.PositionedSound; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Vec3; import common.world.State; @@ -25,7 +25,7 @@ public class PlayerController { private final Client gm; private final ClientPlayer handler; - private BlockPos position = new BlockPos(-1, -World.MAX_SIZE_Y - 1, -1); + private LocalPos position = new LocalPos(-1, -World.MAX_SIZE_Y - 1, -1); private ItemStack stack; private float damage; private float stepCounter; @@ -41,7 +41,7 @@ public class PlayerController { this.handler = handler; } - public boolean destroyBlock(BlockPos pos, Facing side) { + public boolean destroyBlock(LocalPos pos, Facing side) { World world = this.gm.world; State state = world.getState(pos); Block block = state.getBlock(); @@ -57,7 +57,7 @@ public class PlayerController { block.onBroken(world, pos, state); } - this.position = new BlockPos(this.position.getX(), -1, this.position.getZ()); + this.position = new LocalPos(this.position.getX(), -1, this.position.getZ()); ItemStack stack = this.gm.player.getHeldItem(); @@ -73,7 +73,7 @@ public class PlayerController { } } - public boolean clickBlock(BlockPos pos, Facing face) { + public boolean clickBlock(LocalPos pos, Facing face) { if(!World.isValidXZ(pos)) { return false; } @@ -128,7 +128,7 @@ public class PlayerController { this.interacting = false; } - public boolean damageBlock(BlockPos pos, Facing face) { + public boolean damageBlock(LocalPos pos, Facing face) { if(this.interacting) return false; this.syncItem(); @@ -183,7 +183,7 @@ public class PlayerController { } } - private boolean isHitting(BlockPos pos) { + private boolean isHitting(LocalPos pos) { ItemStack stack = this.gm.player.getHeldItem(); boolean flag = this.stack == null && stack == null; @@ -204,11 +204,11 @@ public class PlayerController { } } - public boolean clickRight(EntityNPC player, World world, ItemStack stack, BlockPos pos, Facing side, Vec3 hit) { + public boolean clickRight(EntityNPC player, World world, ItemStack stack, LocalPos pos, Facing side, Vec3 hit) { this.syncItem(); - float f = (float)(hit.xCoord - (double)pos.getX()); - float f1 = (float)(hit.yCoord - (double)pos.getY()); - float f2 = (float)(hit.zCoord - (double)pos.getZ()); + float f = (float)(hit.x - (double)pos.getX()); + float f1 = (float)(hit.y - (double)pos.getY()); + float f2 = (float)(hit.z - (double)pos.getZ()); boolean flag = false; if(!World.isValidXZ(pos)) { @@ -301,7 +301,7 @@ public class PlayerController { public void stopUsing(EntityNPC player) { this.syncItem(); - this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, Facing.DOWN)); + this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.RELEASE_USE_ITEM, LocalPos.ORIGIN, Facing.DOWN)); player.stopUsingItem(); } @@ -321,7 +321,7 @@ public class PlayerController { this.itemUseCooldown = 0; } - public float getDamage(BlockPos pos) { + public float getDamage(LocalPos pos) { return this.hitting && pos.equals(this.position) ? this.damage : 0.0f; } } diff --git a/client/src/main/java/client/world/ChunkClient.java b/client/src/main/java/client/world/ChunkClient.java index 47a892d2..1a967c3f 100644 --- a/client/src/main/java/client/world/ChunkClient.java +++ b/client/src/main/java/client/world/ChunkClient.java @@ -2,18 +2,17 @@ package client.world; import java.util.concurrent.ConcurrentLinkedQueue; -import client.renderer.Renderer; import common.block.Block; import common.block.ITileEntityProvider; import common.init.Blocks; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.BlockArray; import common.world.Chunk; import common.world.World; public class ChunkClient extends Chunk { - private final ConcurrentLinkedQueue tileQueue = new ConcurrentLinkedQueue(); + private final ConcurrentLinkedQueue tileQueue = new ConcurrentLinkedQueue(); private final float[] temperatures = new float[256]; private final float[] offsets = new float[256]; @@ -124,13 +123,13 @@ public class ChunkClient extends Chunk { return false; } - public float getTemperature(BlockPos pos) { + public float getTemperature(LocalPos pos) { int x = pos.getX() & 15; int z = pos.getZ() & 15; return this.temperatures[z << 4 | x]; } - public float getOffset(BlockPos pos) { + public float getOffset(LocalPos pos) { int x = pos.getX() & 15; int z = pos.getZ() & 15; return this.offsets[z << 4 | x]; @@ -138,7 +137,7 @@ public class ChunkClient extends Chunk { public void spawnTiles() { while(!this.tileQueue.isEmpty()) { - BlockPos pos = this.tileQueue.poll(); + LocalPos pos = this.tileQueue.poll(); if(this.getTileEntity(pos, TileEntity.CreateMode.CHECK) == null && this.getBlock(pos) instanceof ITileEntityProvider) { TileEntity tile = this.createNewTileEntity(pos); this.world.setTileEntity(pos, tile); @@ -147,7 +146,7 @@ public class ChunkClient extends Chunk { } } - public TileEntity getTileEntity(BlockPos pos, TileEntity.CreateMode type) { + public TileEntity getTileEntity(LocalPos pos, TileEntity.CreateMode type) { TileEntity tile = this.tiles.get(pos); if(tile == null) { @@ -167,7 +166,7 @@ public class ChunkClient extends Chunk { return tile; } - public int getLight(BlockPos pos) { + public int getLight(LocalPos pos) { int x = pos.getX() & 15; int y = pos.getY(); int z = pos.getZ() & 15; @@ -175,7 +174,7 @@ public class ChunkClient extends Chunk { return stor == null ? 0 : stor.getLight(x, y & 15, z); } - public void setLight(BlockPos pos, int value) { + public void setLight(LocalPos pos, int value) { int x = pos.getX() & 15; int y = pos.getY(); int z = pos.getZ() & 15; diff --git a/client/src/main/java/client/world/ChunkEmpty.java b/client/src/main/java/client/world/ChunkEmpty.java index 46b75239..84e9dd42 100755 --- a/client/src/main/java/client/world/ChunkEmpty.java +++ b/client/src/main/java/client/world/ChunkEmpty.java @@ -10,7 +10,7 @@ import common.entity.Entity; import common.init.BlockRegistry; import common.init.Blocks; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.world.State; @@ -68,15 +68,15 @@ public class ChunkEmpty extends ChunkClient { return this.liquidY; } - public Block getBlock(BlockPos pos) { + public Block getBlock(LocalPos pos) { return pos.getY() < this.liquidY ? this.dummyBlock : (pos.getY() == this.liquidY ? this.liquidBlock : Blocks.air); } - public int getLight(BlockPos pos) { + public int getLight(LocalPos pos) { return 0; } - public void setLight(BlockPos pos, int value) { + public void setLight(LocalPos pos, int value) { } public void addEntity(Entity entity) { @@ -85,14 +85,14 @@ public class ChunkEmpty extends ChunkClient { public void removeEntity(Entity entity) { } - public TileEntity getTileEntity(BlockPos pos, TileEntity.CreateMode type) { + public TileEntity getTileEntity(LocalPos pos, TileEntity.CreateMode type) { return null; } - public void addTileEntity(BlockPos pos, TileEntity tile) { + public void addTileEntity(LocalPos pos, TileEntity tile) { } - public void removeTileEntity(BlockPos pos) { + public void removeTileEntity(LocalPos pos) { } public void getEntities(Entity exclude, BoundingBox bb, List list, Predicate pred) { @@ -109,7 +109,7 @@ public class ChunkEmpty extends ChunkClient { return top < 0 || bottom > this.liquidY; } - public State getState(BlockPos pos) { + public State getState(LocalPos pos) { if(this.debug) { State state = pos.getY() == 1 ? getDebug(pos.getX(), pos.getZ()) : null; return state == null ? Blocks.air.getState() : state; @@ -117,12 +117,12 @@ public class ChunkEmpty extends ChunkClient { return pos.getY() < this.liquidY ? this.dummy : (pos.getY() == this.liquidY ? this.liquid : Blocks.air.getState()); } - public State setState(BlockPos pos, State state, boolean updateLight) { + public State setState(LocalPos pos, State state, boolean updateLight) { return null; } - public BlockPos getPrecipitation(BlockPos pos) { - return new BlockPos(pos.getX(), this.liquidY + 1, pos.getZ()); + public LocalPos getPrecipitation(LocalPos pos) { + return new LocalPos(pos.getX(), this.liquidY + 1, pos.getZ()); } public void spawnTiles() { @@ -134,11 +134,11 @@ public class ChunkEmpty extends ChunkClient { public void setData(byte[] data, int[] extend, boolean biomes) { } - public float getTemperature(BlockPos pos) { + public float getTemperature(LocalPos pos) { return 0.0f; } - public float getOffset(BlockPos pos) { + public float getOffset(LocalPos pos) { return 0.0f; } diff --git a/common/src/main/java/common/ai/AIFireAttack.java b/common/src/main/java/common/ai/AIFireAttack.java index 9186763f..f2cfb9b4 100644 --- a/common/src/main/java/common/ai/AIFireAttack.java +++ b/common/src/main/java/common/ai/AIFireAttack.java @@ -3,7 +3,7 @@ package common.ai; import common.entity.projectile.EntityFireball; import common.entity.types.EntityLiving; import common.init.SoundEvent; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Vec3; import common.world.World; @@ -49,16 +49,16 @@ public class AIFireAttack extends EntityAIBase this.parentEntity.playSound(SoundEvent.DRAGON_GROWL, 5.0f); double d1 = 1.0D; Vec3 vec3 = this.parentEntity.getLook(1.0F); - double d2 = target.posX - (this.parentEntity.posX + vec3.xCoord * d1); + double d2 = target.posX - (this.parentEntity.posX + vec3.x * d1); double d3 = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) - (this.parentEntity.posY + (double)this.parentEntity.getEyeHeight()); - double d4 = target.posZ - (this.parentEntity.posZ + vec3.zCoord * d1); - world.playEffect(1008, new BlockPos(this.parentEntity), 0); + double d4 = target.posZ - (this.parentEntity.posZ + vec3.z * d1); + world.playEffect(1008, new LocalPos(this.parentEntity), 0); EntityFireball fireball = new EntityFireball(world, this.parentEntity, d2, d3, d4, this.velocity); fireball.explosionPower = this.power; fireball.damageBlocks = true; - fireball.posX = this.parentEntity.posX + vec3.xCoord * d1; + fireball.posX = this.parentEntity.posX + vec3.x * d1; fireball.posY = this.parentEntity.posY + (double)this.parentEntity.getEyeHeight(); - fireball.posZ = this.parentEntity.posZ + vec3.zCoord * d1; + fireball.posZ = this.parentEntity.posZ + vec3.z * d1; world.spawnEntityInWorld(fireball); this.attackTimer = -this.delay * this.parentEntity.getRNG().range(1, 4); } diff --git a/common/src/main/java/common/ai/AIFireballAttack.java b/common/src/main/java/common/ai/AIFireballAttack.java index 985eae9f..7a19bfe7 100755 --- a/common/src/main/java/common/ai/AIFireballAttack.java +++ b/common/src/main/java/common/ai/AIFireballAttack.java @@ -5,7 +5,7 @@ import common.entity.projectile.EntityFireball; import common.entity.types.EntityLiving; import common.init.Items; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Vec3; import common.world.World; @@ -54,7 +54,7 @@ public class AIFireballAttack extends EntityAIBase if (this.attackTimer == this.delay) { - world.playEffect(1007, new BlockPos(this.parentEntity), 0); + world.playEffect(1007, new LocalPos(this.parentEntity), 0); this.parentEntity.setHeldNoUpdate(new ItemStack(Items.orb)); } @@ -64,15 +64,15 @@ public class AIFireballAttack extends EntityAIBase this.parentEntity.setHeldNoUpdate(null); double d1 = 1.0D; Vec3 vec3 = this.parentEntity.getLook(1.0F); - double d2 = target.posX - (this.parentEntity.posX + vec3.xCoord * d1); + double d2 = target.posX - (this.parentEntity.posX + vec3.x * d1); double d3 = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) - (this.parentEntity.posY + (double)this.parentEntity.getEyeHeight()); - double d4 = target.posZ - (this.parentEntity.posZ + vec3.zCoord * d1); - world.playEffect(1008, new BlockPos(this.parentEntity), 0); + double d4 = target.posZ - (this.parentEntity.posZ + vec3.z * d1); + world.playEffect(1008, new LocalPos(this.parentEntity), 0); EntityFireball fireball = new EntityFireball(world, this.parentEntity, d2, d3, d4, this.velocity); fireball.explosionPower = this.power; - fireball.posX = this.parentEntity.posX + vec3.xCoord * d1; + fireball.posX = this.parentEntity.posX + vec3.x * d1; fireball.posY = this.parentEntity.posY + (double)this.parentEntity.getEyeHeight(); - fireball.posZ = this.parentEntity.posZ + vec3.zCoord * d1; + fireball.posZ = this.parentEntity.posZ + vec3.z * d1; world.spawnEntityInWorld(fireball); this.attackTimer = -this.delay * this.parentEntity.getRNG().range(1, 4); } diff --git a/common/src/main/java/common/ai/AIFlyingBoxAttack.java b/common/src/main/java/common/ai/AIFlyingBoxAttack.java index cbfd7c46..86f67b01 100755 --- a/common/src/main/java/common/ai/AIFlyingBoxAttack.java +++ b/common/src/main/java/common/ai/AIFlyingBoxAttack.java @@ -3,7 +3,7 @@ package common.ai; import common.entity.npc.EntityNPC; import common.entity.projectile.EntityBox; import common.entity.types.EntityLiving; -import common.util.BlockPos; +import common.util.LocalPos; public class AIFlyingBoxAttack extends EntityAIBase { @@ -74,7 +74,7 @@ public class AIFlyingBoxAttack extends EntityAIBase private void launchBoxToCoords(double x, double y, double z, boolean invulnerable) { this.entity.swingItem(); - this.entity.worldObj.playEffect(1014, new BlockPos(this.entity), 0); + this.entity.worldObj.playEffect(1014, new LocalPos(this.entity), 0); double d0 = this.entity.posX; double d1 = this.entity.posY + this.entity.height + 0.8; double d2 = this.entity.posZ; diff --git a/common/src/main/java/common/ai/AISmallFireballAttack.java b/common/src/main/java/common/ai/AISmallFireballAttack.java index e3b1171b..bb4bd750 100755 --- a/common/src/main/java/common/ai/AISmallFireballAttack.java +++ b/common/src/main/java/common/ai/AISmallFireballAttack.java @@ -3,7 +3,7 @@ package common.ai; import common.entity.npc.EntityNPC; import common.entity.projectile.EntityFireCharge; import common.entity.types.EntityLiving; -import common.util.BlockPos; +import common.util.LocalPos; public class AISmallFireballAttack extends EntityAIBase { @@ -81,7 +81,7 @@ public class AISmallFireballAttack extends EntityAIBase { this.entity.swingItem(); // float f = MathHelper.sqrt_float(MathHelper.sqrt_double(d0)) * 0.5F; - this.entity.worldObj.playEffect(1009, new BlockPos((int)this.entity.posX, (int)this.entity.posY, (int)this.entity.posZ), 0); + this.entity.worldObj.playEffect(1009, new LocalPos((int)this.entity.posX, (int)this.entity.posY, (int)this.entity.posZ), 0); for (int i = 0; i < 1; ++i) { diff --git a/common/src/main/java/common/ai/EntityAIAttackOnCollide.java b/common/src/main/java/common/ai/EntityAIAttackOnCollide.java index ba225f23..1f2f6811 100755 --- a/common/src/main/java/common/ai/EntityAIAttackOnCollide.java +++ b/common/src/main/java/common/ai/EntityAIAttackOnCollide.java @@ -3,7 +3,7 @@ package common.ai; import common.entity.Entity; import common.entity.types.EntityLiving; import common.pathfinding.PathEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class EntityAIAttackOnCollide extends EntityAIBase @@ -92,7 +92,7 @@ public class EntityAIAttackOnCollide extends EntityAIBase public boolean continueExecuting() { EntityLiving entitylivingbase = this.attacker.getAttackTarget(); - return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : (!this.longMemory ? !this.attacker.getNavigator().noPath() : this.attacker.isWithinHomeDistanceFromPosition(new BlockPos(entitylivingbase)))); + return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : (!this.longMemory ? !this.attacker.getNavigator().noPath() : this.attacker.isWithinHomeDistanceFromPosition(new LocalPos(entitylivingbase)))); } /** diff --git a/common/src/main/java/common/ai/EntityAIAvoidEntity.java b/common/src/main/java/common/ai/EntityAIAvoidEntity.java index 2e26f2b4..c1b74ff5 100755 --- a/common/src/main/java/common/ai/EntityAIAvoidEntity.java +++ b/common/src/main/java/common/ai/EntityAIAvoidEntity.java @@ -73,13 +73,13 @@ public class EntityAIAvoidEntity extends EntityAIBase { return false; } - else if (this.closestLivingEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity)) + else if (this.closestLivingEntity.getDistanceSq(vec3.x, vec3.y, vec3.z) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity)) { return false; } else { - this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord); + this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3.x, vec3.y, vec3.z); return this.entityPathEntity == null ? false : this.entityPathEntity.isDestinationSame(vec3); } } diff --git a/common/src/main/java/common/ai/EntityAICatSit.java b/common/src/main/java/common/ai/EntityAICatSit.java index 3595c6e2..81e8ab50 100755 --- a/common/src/main/java/common/ai/EntityAICatSit.java +++ b/common/src/main/java/common/ai/EntityAICatSit.java @@ -7,7 +7,7 @@ import common.block.tech.BlockFurnace; import common.entity.animal.EntityCat; import common.tileentity.TileEntity; import common.tileentity.TileEntityChest; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import common.world.World; @@ -76,7 +76,7 @@ public class EntityAICatSit extends EntityAIMoveToBlock /** * Return true to set given position as destination */ - protected boolean shouldMoveTo(World worldIn, BlockPos pos) + protected boolean shouldMoveTo(World worldIn, LocalPos pos) { if (!worldIn.isAirBlock(pos.up())) { diff --git a/common/src/main/java/common/ai/EntityAIControlledByPlayer.java b/common/src/main/java/common/ai/EntityAIControlledByPlayer.java index 1bc21b78..a86f5182 100755 --- a/common/src/main/java/common/ai/EntityAIControlledByPlayer.java +++ b/common/src/main/java/common/ai/EntityAIControlledByPlayer.java @@ -9,7 +9,7 @@ import common.init.Blocks; import common.init.Items; import common.item.ItemStack; import common.pathfinding.WalkNodeProcessor; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; public class EntityAIControlledByPlayer extends EntityAIBase @@ -111,7 +111,7 @@ public class EntityAIControlledByPlayer extends EntityAIBase if (this.thisEntity.onGround) { - f2 = this.thisEntity.worldObj.getState(new BlockPos(ExtMath.floorf((float)i), ExtMath.floorf((float)j) - 1, ExtMath.floorf((float)k))).getBlock().getSlipperiness() * 0.91F; + f2 = this.thisEntity.worldObj.getState(new LocalPos(ExtMath.floorf((float)i), ExtMath.floorf((float)j) - 1, ExtMath.floorf((float)k))).getBlock().getSlipperiness() * 0.91F; } float f3 = 0.16277136F / (f2 * f2 * f2); @@ -161,8 +161,8 @@ public class EntityAIControlledByPlayer extends EntityAIBase if (i != l || k != i1) { - Block block = this.thisEntity.worldObj.getState(new BlockPos(i, j, k)).getBlock(); - boolean flag = !this.isStairOrSlab(block) && (block != Blocks.air || !this.isStairOrSlab(this.thisEntity.worldObj.getState(new BlockPos(i, j - 1, k)).getBlock())); + Block block = this.thisEntity.worldObj.getState(new LocalPos(i, j, k)).getBlock(); + boolean flag = !this.isStairOrSlab(block) && (block != Blocks.air || !this.isStairOrSlab(this.thisEntity.worldObj.getState(new LocalPos(i, j - 1, k)).getBlock())); if (flag && 0 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j, i1, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, i, j + 1, k, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j + 1, i1, j1, k1, l1, false, false, true)) { diff --git a/common/src/main/java/common/ai/EntityAIDoorInteract.java b/common/src/main/java/common/ai/EntityAIDoorInteract.java index e98a1f47..4fea34a1 100755 --- a/common/src/main/java/common/ai/EntityAIDoorInteract.java +++ b/common/src/main/java/common/ai/EntityAIDoorInteract.java @@ -7,12 +7,12 @@ import common.entity.types.EntityLiving; import common.pathfinding.PathEntity; import common.pathfinding.PathNavigateGround; import common.pathfinding.PathPoint; -import common.util.BlockPos; +import common.util.LocalPos; public abstract class EntityAIDoorInteract extends EntityAIBase { protected EntityLiving theEntity; - protected BlockPos doorPosition = BlockPos.ORIGIN; + protected LocalPos doorPosition = LocalPos.ORIGIN; /** The wooden door block */ protected BlockDoor doorBlock; @@ -53,7 +53,7 @@ public abstract class EntityAIDoorInteract extends EntityAIBase for (int i = 0; i < Math.min(pathentity.getCurrentPathIndex() + 2, pathentity.getCurrentPathLength()); ++i) { PathPoint pathpoint = pathentity.getPathPointFromIndex(i); - this.doorPosition = new BlockPos(pathpoint.xCoord, pathpoint.yCoord + 1, pathpoint.zCoord); + this.doorPosition = new LocalPos(pathpoint.xCoord, pathpoint.yCoord + 1, pathpoint.zCoord); if (this.theEntity.getDistanceSq((double)this.doorPosition.getX(), this.theEntity.posY, (double)this.doorPosition.getZ()) <= 2.25D) { @@ -66,7 +66,7 @@ public abstract class EntityAIDoorInteract extends EntityAIBase } } - this.doorPosition = (new BlockPos(this.theEntity)).up(); + this.doorPosition = (new LocalPos(this.theEntity)).up(); this.doorBlock = this.getBlockDoor(this.doorPosition); return this.doorBlock != null; } @@ -110,7 +110,7 @@ public abstract class EntityAIDoorInteract extends EntityAIBase } } - private BlockDoor getBlockDoor(BlockPos pos) + private BlockDoor getBlockDoor(LocalPos pos) { Block block = this.theEntity.worldObj.getState(pos).getBlock(); return block instanceof BlockDoor && block.getMaterial() == Material.WOOD ? (BlockDoor)block : null; diff --git a/common/src/main/java/common/ai/EntityAIEatGrass.java b/common/src/main/java/common/ai/EntityAIEatGrass.java index d773f9de..4143fb59 100755 --- a/common/src/main/java/common/ai/EntityAIEatGrass.java +++ b/common/src/main/java/common/ai/EntityAIEatGrass.java @@ -3,7 +3,7 @@ package common.ai; import common.entity.animal.EntitySheep; import common.init.BlockRegistry; import common.init.Blocks; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.World; @@ -32,7 +32,7 @@ public class EntityAIEatGrass extends EntityAIBase } else { - BlockPos blockpos = new BlockPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ); + LocalPos blockpos = new LocalPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ); State state = this.entityWorld.getState(blockpos); return state.getBlock() == Blocks.tallgrass || this.entityWorld.getState(blockpos.down()).getBlock() == Blocks.grass; @@ -82,7 +82,7 @@ public class EntityAIEatGrass extends EntityAIBase if (this.eatingGrassTimer == 4) { - BlockPos blockpos = new BlockPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ); + LocalPos blockpos = new LocalPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ); State state = this.entityWorld.getState(blockpos); if (state.getBlock() == Blocks.tallgrass) @@ -96,7 +96,7 @@ public class EntityAIEatGrass extends EntityAIBase } else { - BlockPos blockpos1 = blockpos.down(); + LocalPos blockpos1 = blockpos.down(); if (this.entityWorld.getState(blockpos1).getBlock() == Blocks.grass) { diff --git a/common/src/main/java/common/ai/EntityAIHarvestFarmland.java b/common/src/main/java/common/ai/EntityAIHarvestFarmland.java index 9ea311bd..3c80e7b8 100755 --- a/common/src/main/java/common/ai/EntityAIHarvestFarmland.java +++ b/common/src/main/java/common/ai/EntityAIHarvestFarmland.java @@ -1,7 +1,7 @@ package common.ai; import common.entity.types.EntityLiving; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class EntityAIHarvestFarmland extends EntityAIMoveToBlock @@ -131,7 +131,7 @@ public class EntityAIHarvestFarmland extends EntityAIMoveToBlock // /** // * Return true to set given position as destination // */ - protected boolean shouldMoveTo(World worldIn, BlockPos pos) + protected boolean shouldMoveTo(World worldIn, LocalPos pos) { // Block block = worldIn.getBlockState(pos).getBlock(); // diff --git a/common/src/main/java/common/ai/EntityAIMoveToBlock.java b/common/src/main/java/common/ai/EntityAIMoveToBlock.java index 2eb4c0f2..9b156030 100755 --- a/common/src/main/java/common/ai/EntityAIMoveToBlock.java +++ b/common/src/main/java/common/ai/EntityAIMoveToBlock.java @@ -1,7 +1,7 @@ package common.ai; import common.entity.types.EntityLiving; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public abstract class EntityAIMoveToBlock extends EntityAIBase @@ -15,7 +15,7 @@ public abstract class EntityAIMoveToBlock extends EntityAIBase private int field_179490_f; /** Block to move to */ - protected BlockPos destinationBlock = BlockPos.ORIGIN; + protected LocalPos destinationBlock = LocalPos.ORIGIN; private boolean isAboveDestination; private int searchLength; @@ -105,7 +105,7 @@ public abstract class EntityAIMoveToBlock extends EntityAIBase { int i = this.searchLength; int j = 1; - BlockPos blockpos = new BlockPos(this.theEntity); + LocalPos blockpos = new LocalPos(this.theEntity); for (int k = 0; k <= 1; k = k > 0 ? -k : 1 - k) { @@ -115,7 +115,7 @@ public abstract class EntityAIMoveToBlock extends EntityAIBase { for (int j1 = i1 < l && i1 > -l ? l : 0; j1 <= l; j1 = j1 > 0 ? -j1 : 1 - j1) { - BlockPos blockpos1 = blockpos.add(i1, k - 1, j1); + LocalPos blockpos1 = blockpos.add(i1, k - 1, j1); if (this.theEntity.isWithinHomeDistanceFromPosition(blockpos1) && this.shouldMoveTo(this.theEntity.worldObj, blockpos1)) { @@ -133,5 +133,5 @@ public abstract class EntityAIMoveToBlock extends EntityAIBase /** * Return true to set given position as destination */ - protected abstract boolean shouldMoveTo(World worldIn, BlockPos pos); + protected abstract boolean shouldMoveTo(World worldIn, LocalPos pos); } diff --git a/common/src/main/java/common/ai/EntityAIMoveTowardsRestriction.java b/common/src/main/java/common/ai/EntityAIMoveTowardsRestriction.java index 5df934d9..b4492cd2 100755 --- a/common/src/main/java/common/ai/EntityAIMoveTowardsRestriction.java +++ b/common/src/main/java/common/ai/EntityAIMoveTowardsRestriction.java @@ -1,7 +1,7 @@ package common.ai; import common.entity.types.EntityLiving; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Vec3; public class EntityAIMoveTowardsRestriction extends EntityAIBase @@ -30,7 +30,7 @@ public class EntityAIMoveTowardsRestriction extends EntityAIBase } else { - BlockPos blockpos = this.theEntity.getHomePosition(); + LocalPos blockpos = this.theEntity.getHomePosition(); Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ())); if (vec3 == null) @@ -39,9 +39,9 @@ public class EntityAIMoveTowardsRestriction extends EntityAIBase } else { - this.movePosX = vec3.xCoord; - this.movePosY = vec3.yCoord; - this.movePosZ = vec3.zCoord; + this.movePosX = vec3.x; + this.movePosY = vec3.y; + this.movePosZ = vec3.z; return true; } } diff --git a/common/src/main/java/common/ai/EntityAIMoveTowardsTarget.java b/common/src/main/java/common/ai/EntityAIMoveTowardsTarget.java index a77254dc..c2c5fd04 100755 --- a/common/src/main/java/common/ai/EntityAIMoveTowardsTarget.java +++ b/common/src/main/java/common/ai/EntityAIMoveTowardsTarget.java @@ -50,9 +50,9 @@ public class EntityAIMoveTowardsTarget extends EntityAIBase } else { - this.movePosX = vec3.xCoord; - this.movePosY = vec3.yCoord; - this.movePosZ = vec3.zCoord; + this.movePosX = vec3.x; + this.movePosY = vec3.y; + this.movePosZ = vec3.z; return true; } } diff --git a/common/src/main/java/common/ai/EntityAIPanic.java b/common/src/main/java/common/ai/EntityAIPanic.java index 78487529..c46d1fc2 100755 --- a/common/src/main/java/common/ai/EntityAIPanic.java +++ b/common/src/main/java/common/ai/EntityAIPanic.java @@ -37,9 +37,9 @@ public class EntityAIPanic extends EntityAIBase } else { - this.randPosX = vec3.xCoord; - this.randPosY = vec3.yCoord; - this.randPosZ = vec3.zCoord; + this.randPosX = vec3.x; + this.randPosY = vec3.y; + this.randPosZ = vec3.z; return true; } } diff --git a/common/src/main/java/common/ai/EntityAIPlay.java b/common/src/main/java/common/ai/EntityAIPlay.java index f64d2191..0543baa9 100755 --- a/common/src/main/java/common/ai/EntityAIPlay.java +++ b/common/src/main/java/common/ai/EntityAIPlay.java @@ -66,7 +66,7 @@ public class EntityAIPlay extends EntityAIBase { Vec3 vec = RandomPositionGenerator.findRandomTarget(this.entity, 16, 3); if(vec == null) return; - this.entity.getNavigator().tryMoveToXYZ(vec.xCoord, vec.yCoord, vec.zCoord, this.speed); + this.entity.getNavigator().tryMoveToXYZ(vec.x, vec.y, vec.z, this.speed); } } } diff --git a/common/src/main/java/common/ai/EntityAIRunAroundLikeCrazy.java b/common/src/main/java/common/ai/EntityAIRunAroundLikeCrazy.java index 08680dde..590beb3d 100755 --- a/common/src/main/java/common/ai/EntityAIRunAroundLikeCrazy.java +++ b/common/src/main/java/common/ai/EntityAIRunAroundLikeCrazy.java @@ -35,9 +35,9 @@ public class EntityAIRunAroundLikeCrazy extends EntityAIBase } else { - this.targetX = vec3.xCoord; - this.targetY = vec3.yCoord; - this.targetZ = vec3.zCoord; + this.targetX = vec3.x; + this.targetY = vec3.y; + this.targetZ = vec3.z; return true; } } diff --git a/common/src/main/java/common/ai/EntityAITakePlace.java b/common/src/main/java/common/ai/EntityAITakePlace.java index 08fc9140..052a5998 100755 --- a/common/src/main/java/common/ai/EntityAITakePlace.java +++ b/common/src/main/java/common/ai/EntityAITakePlace.java @@ -10,7 +10,7 @@ import common.init.Blocks; import common.item.Item; import common.item.ItemStack; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.vars.Vars; import common.world.State; @@ -69,7 +69,7 @@ public class EntityAITakePlace extends EntityAIBase int i = ExtMath.floord(this.entity.posX - (this.place ? 1.0 : 2.0) + random.doublev() * (this.place ? 2.0 : 4.0)); int j = ExtMath.floord(this.entity.posY + random.doublev() * (this.place ? 2.0 : 3.0)); int k = ExtMath.floord(this.entity.posZ - (this.place ? 1.0 : 2.0) + random.doublev() * (this.place ? 2.0 : 4.0)); - BlockPos blockpos = new BlockPos(i, j, k); + LocalPos blockpos = new LocalPos(i, j, k); if(this.place) { ItemStack stack = this.entity.getHeldItem(); if(stack == null || !PLACEABLE.containsKey(stack.getItem())) diff --git a/common/src/main/java/common/ai/EntityAITarget.java b/common/src/main/java/common/ai/EntityAITarget.java index 77990577..85a59d71 100755 --- a/common/src/main/java/common/ai/EntityAITarget.java +++ b/common/src/main/java/common/ai/EntityAITarget.java @@ -5,7 +5,7 @@ import common.entity.types.EntityLiving; import common.entity.types.IEntityOwnable; import common.pathfinding.PathEntity; import common.pathfinding.PathPoint; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.vars.Vars; @@ -192,7 +192,7 @@ public abstract class EntityAITarget extends EntityAIBase { return false; } - else if (!this.taskOwner.isWithinHomeDistanceFromPosition(new BlockPos(target))) + else if (!this.taskOwner.isWithinHomeDistanceFromPosition(new LocalPos(target))) { return false; } diff --git a/common/src/main/java/common/ai/EntityAIWander.java b/common/src/main/java/common/ai/EntityAIWander.java index 79067a64..76308796 100755 --- a/common/src/main/java/common/ai/EntityAIWander.java +++ b/common/src/main/java/common/ai/EntityAIWander.java @@ -52,9 +52,9 @@ public class EntityAIWander extends EntityAIBase } else { - this.xPosition = vec3.xCoord; - this.yPosition = vec3.yCoord; - this.zPosition = vec3.zCoord; + this.xPosition = vec3.x; + this.yPosition = vec3.y; + this.zPosition = vec3.z; // this.mustUpdate = false; return true; } diff --git a/common/src/main/java/common/ai/RandomPositionGenerator.java b/common/src/main/java/common/ai/RandomPositionGenerator.java index 54b1bae5..ad0b5871 100755 --- a/common/src/main/java/common/ai/RandomPositionGenerator.java +++ b/common/src/main/java/common/ai/RandomPositionGenerator.java @@ -2,7 +2,7 @@ package common.ai; import common.entity.types.EntityLiving; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Vec3; @@ -71,11 +71,11 @@ public class RandomPositionGenerator int k1 = random.zrange(2 * y + 1) - y; int i1 = random.zrange(2 * xz + 1) - xz; - if (targetVec3 == null || (double)l * targetVec3.xCoord + (double)i1 * targetVec3.zCoord >= 0.0D) + if (targetVec3 == null || (double)l * targetVec3.x + (double)i1 * targetVec3.z >= 0.0D) { if (entitycreatureIn.hasHome() && xz > 1) { - BlockPos blockpos = entitycreatureIn.getHomePosition(); + LocalPos blockpos = entitycreatureIn.getHomePosition(); if (entitycreatureIn.posX > (double)blockpos.getX()) { @@ -99,7 +99,7 @@ public class RandomPositionGenerator l = l + ExtMath.floord(entitycreatureIn.posX); k1 = k1 + ExtMath.floord(entitycreatureIn.posY); i1 = i1 + ExtMath.floord(entitycreatureIn.posZ); - BlockPos blockpos1 = new BlockPos(l, k1, i1); + LocalPos blockpos1 = new LocalPos(l, k1, i1); if (!flag1 || entitycreatureIn.isWithinHomeDistanceFromPosition(blockpos1)) { diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index bc326ff3..0b0719e4 100755 --- a/common/src/main/java/common/block/Block.java +++ b/common/src/main/java/common/block/Block.java @@ -40,7 +40,7 @@ import common.model.GuiPosition; import common.properties.Property; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.Facing; @@ -311,7 +311,7 @@ public class Block { return ImmutableList.copyOf(list); } - public static void dropItem(World world, BlockPos pos, ItemStack stack) { + public static void dropItem(World world, LocalPos pos, ItemStack stack) { if(!world.client && Vars.blockDrop) { float range = 0.5F; double x = (double)(world.rand.floatv() * range) + (double)(1.0F - range) * 0.5D; @@ -323,7 +323,7 @@ public class Block { } } - public static void dropExperience(World world, BlockPos pos, int amount) { + public static void dropExperience(World world, LocalPos pos, int amount) { if(!world.client && Vars.blockXP) { while(amount > 0) { int split = EntityXp.getXPSplit(amount); @@ -334,7 +334,7 @@ public class Block { } @Serverside - public static void dropItems(AWorldServer world, BlockPos pos, IInventory inventory) { + public static void dropItems(AWorldServer world, LocalPos pos, IInventory inventory) { for(int n = 0; n < inventory.getSizeInventory(); n++) { ItemStack stack = inventory.getStackInSlot(n); if(stack == null) @@ -567,7 +567,7 @@ public class Block { return this.maxZ; } - public final float getHardness(EntityNPC player, World world, BlockPos pos) { + public final float getHardness(EntityNPC player, World world, LocalPos pos) { float f = this.getHardness(world, pos); return f < 0.0F ? 0.0F : (!player.canHarvestBlock(this) ? player.getToolDigEfficiency(this) / f / 100.0F @@ -623,7 +623,7 @@ public class Block { return new Property[0]; } - public State getState(State state, IWorldAccess world, BlockPos pos) { + public State getState(State state, IWorldAccess world, LocalPos pos) { return state; } @@ -643,25 +643,25 @@ public class Block { return true; } - public boolean isPassable(IBlockAccess world, BlockPos pos) { + public boolean isPassable(IBlockAccess world, LocalPos pos) { return !this.material.blocksMovement(); } - public boolean canReplace(World world, BlockPos pos) { + public boolean canReplace(World world, LocalPos pos) { return false; } - public float getHardness(World world, BlockPos pos) { + public float getHardness(World world, LocalPos pos) { return this.hardness; } - public void getCollisionBoxes(World world, BlockPos pos, State state, BoundingBox mask, List list, Entity colliding) { + public void getCollisionBoxes(World world, LocalPos pos, State state, BoundingBox mask, List list, Entity colliding) { BoundingBox bb = this.getCollisionBox(world, pos, state); if(bb != null && mask.intersectsWith(bb)) list.add(bb); } - public BoundingBox getCollisionBox(World world, BlockPos pos, State state) { + public BoundingBox getCollisionBox(World world, LocalPos pos, State state) { return 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); } @@ -670,16 +670,16 @@ public class Block { return true; } - public HitPosition rayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) { + public HitPosition rayTrace(World world, LocalPos pos, Vec3 start, Vec3 end) { this.setBlockBounds(world, pos); - start = start.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); - end = end.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); - Vec3 vec3 = start.getIntermediateWithXValue(end, this.minX); - Vec3 vec31 = start.getIntermediateWithXValue(end, this.maxX); - Vec3 vec32 = start.getIntermediateWithYValue(end, this.minY); - Vec3 vec33 = start.getIntermediateWithYValue(end, this.maxY); - Vec3 vec34 = start.getIntermediateWithZValue(end, this.minZ); - Vec3 vec35 = start.getIntermediateWithZValue(end, this.maxZ); + start = start.add((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); + end = end.add((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); + Vec3 vec3 = start.intermediateX(end, this.minX); + Vec3 vec31 = start.intermediateX(end, this.maxX); + Vec3 vec32 = start.intermediateY(end, this.minY); + Vec3 vec33 = start.intermediateY(end, this.maxY); + Vec3 vec34 = start.intermediateZ(end, this.minZ); + Vec3 vec35 = start.intermediateZ(end, this.maxZ); if(!this.isInsideYZ(vec3)) { vec3 = null; @@ -707,27 +707,27 @@ public class Block { Vec3 vec36 = null; - if(vec3 != null && (vec36 == null || start.squareDistanceTo(vec3) < start.squareDistanceTo(vec36))) { + if(vec3 != null && (vec36 == null || start.distanceSq(vec3) < start.distanceSq(vec36))) { vec36 = vec3; } - if(vec31 != null && (vec36 == null || start.squareDistanceTo(vec31) < start.squareDistanceTo(vec36))) { + if(vec31 != null && (vec36 == null || start.distanceSq(vec31) < start.distanceSq(vec36))) { vec36 = vec31; } - if(vec32 != null && (vec36 == null || start.squareDistanceTo(vec32) < start.squareDistanceTo(vec36))) { + if(vec32 != null && (vec36 == null || start.distanceSq(vec32) < start.distanceSq(vec36))) { vec36 = vec32; } - if(vec33 != null && (vec36 == null || start.squareDistanceTo(vec33) < start.squareDistanceTo(vec36))) { + if(vec33 != null && (vec36 == null || start.distanceSq(vec33) < start.distanceSq(vec36))) { vec36 = vec33; } - if(vec34 != null && (vec36 == null || start.squareDistanceTo(vec34) < start.squareDistanceTo(vec36))) { + if(vec34 != null && (vec36 == null || start.distanceSq(vec34) < start.distanceSq(vec36))) { vec36 = vec34; } - if(vec35 != null && (vec36 == null || start.squareDistanceTo(vec35) < start.squareDistanceTo(vec36))) { + if(vec35 != null && (vec36 == null || start.distanceSq(vec35) < start.distanceSq(vec36))) { vec36 = vec35; } @@ -761,26 +761,26 @@ public class Block { enumfacing = Facing.SOUTH; } - return new HitPosition(ObjectType.BLOCK, vec36.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), enumfacing, pos); + return new HitPosition(ObjectType.BLOCK, vec36.add((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), enumfacing, pos); } } private boolean isInsideYZ(Vec3 point) { return point == null ? false - : point.yCoord >= this.minY && point.yCoord <= this.maxY && point.zCoord >= this.minZ && point.zCoord <= this.maxZ; + : point.y >= this.minY && point.y <= this.maxY && point.z >= this.minZ && point.z <= this.maxZ; } private boolean isInsideXZ(Vec3 point) { return point == null ? false - : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.zCoord >= this.minZ && point.zCoord <= this.maxZ; + : point.x >= this.minX && point.x <= this.maxX && point.z >= this.minZ && point.z <= this.maxZ; } private boolean isInsideXY(Vec3 point) { return point == null ? false - : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.yCoord >= this.minY && point.yCoord <= this.maxY; + : point.x >= this.minX && point.x <= this.maxX && point.y >= this.minY && point.y <= this.maxY; } - public int tickRate(World world, BlockPos pos) { + public int tickRate(World world, LocalPos pos) { return 10; } @@ -788,19 +788,19 @@ public class Block { return this.resistance; } - public boolean canPlace(World world, BlockPos pos, Facing side) { + public boolean canPlace(World world, LocalPos pos, Facing side) { return this.canPlace(world, pos); } - public boolean canPlace(World world, BlockPos pos) { + public boolean canPlace(World world, LocalPos pos) { return world.getState(pos).getBlock().getMaterial().isReplaceable(); } - public Vec3 getAcceleration(World world, BlockPos pos, Entity entity, Vec3 motion) { + public Vec3 getAcceleration(World world, LocalPos pos, Entity entity, Vec3 motion) { return motion; } - public void setBlockBounds(IWorldAccess world, BlockPos pos) { + public void setBlockBounds(IWorldAccess world, LocalPos pos) { } public boolean canSilkHarvest() { @@ -840,7 +840,7 @@ public class Block { } @Serverside - public double getResistance(AWorldServer world, BlockPos pos, State state) { + public double getResistance(AWorldServer world, LocalPos pos, State state) { return Double.POSITIVE_INFINITY; } @@ -862,23 +862,23 @@ public class Block { @Serverside - public void tick(AWorldServer world, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer world, LocalPos pos, State state, Random rand) { } @Clientside - public void displayTick(World world, BlockPos pos, State state, Random rand) { + public void displayTick(World world, LocalPos pos, State state, Random rand) { } - public void onStartBreak(World world, BlockPos pos, EntityNPC player) { + public void onStartBreak(World world, LocalPos pos, EntityNPC player) { } - public void preBroken(World world, BlockPos pos, State state, EntityNPC player) { + public void preBroken(World world, LocalPos pos, State state, EntityNPC player) { } - public void onBroken(World world, BlockPos pos, State state) { + public void onBroken(World world, LocalPos pos, State state) { } - public void postBroken(World world, EntityNPC player, BlockPos pos, State state, TileEntity te) { + public void postBroken(World world, EntityNPC player, LocalPos pos, State state, TileEntity te) { if(this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) { Item item = this.getItem(); if(item != null) @@ -890,7 +890,7 @@ public class Block { } } - public void drop(World world, BlockPos pos, State state, int fortune) { + public void drop(World world, LocalPos pos, State state, int fortune) { if(!world.client) { int amount = this.getDropAmount(fortune, world.rand); for(int z = 0; z < amount; z++) { @@ -901,55 +901,55 @@ public class Block { } } - public void onDestroyedFire(World world, BlockPos pos, State state) { + public void onDestroyedFire(World world, LocalPos pos, State state) { } - public void onDestroyedExplosion(World world, BlockPos pos, EntityLiving source, State state) { + public void onDestroyedExplosion(World world, LocalPos pos, EntityLiving source, State state) { } - public boolean onUse(World world, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World world, LocalPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { return false; } - public void onUpdate(AWorldServer world, BlockPos pos, State state, Block neighbor) { + public void onUpdate(AWorldServer world, LocalPos pos, State state, Block neighbor) { } - public void onAdded(AWorldServer world, BlockPos pos, State state) { + public void onAdded(AWorldServer world, LocalPos pos, State state) { } - public void onRemoved(AWorldServer world, BlockPos pos, State state) { + public void onRemoved(AWorldServer world, LocalPos pos, State state) { } - public void onCollideMove(World world, BlockPos pos, Entity entity) { + public void onCollideMove(World world, LocalPos pos, Entity entity) { } public void onLandMove(World world, Entity entity) { entity.motionY = 0.0D; } - public void onCollideUpdate(World world, BlockPos pos, State state, Entity entity) { + public void onCollideUpdate(World world, LocalPos pos, State state, Entity entity) { } - public void onLandUpdate(World world, BlockPos pos, Entity entity, float distance) { + public void onLandUpdate(World world, LocalPos pos, Entity entity, float distance) { entity.fall(distance, 1.0F); } @Serverside - public void onRain(AWorldServer world, BlockPos pos) { + public void onRain(AWorldServer world, LocalPos pos) { } @Serverside - public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) { + public boolean onShot(AWorldServer world, LocalPos pos, State state, Entity projectile) { return this.material.blocksMovement(); } @Serverside - public double powerTick(AWorldServer world, BlockPos pos, State state, Random rand, double voltage, double currentLimit) { + public double powerTick(AWorldServer world, LocalPos pos, State state, Random rand, double voltage, double currentLimit) { return 0.0; } @Clientside - public boolean checkPlace(World world, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) { + public boolean checkPlace(World world, LocalPos pos, Facing side, EntityNPC player, ItemStack stack) { Block block = world.getState(pos).getBlock(); if(block == Blocks.snow_layer) { @@ -966,7 +966,7 @@ public class Block { return false; } - public boolean place(ItemStack stack, EntityNPC player, World world, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { + public boolean place(ItemStack stack, EntityNPC player, World world, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { State iblockstate = world.getState(pos); Block block = iblockstate.getBlock(); @@ -1003,15 +1003,15 @@ public class Block { } } - public State getPlacedState(World world, BlockPos pos, Facing side, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World world, LocalPos pos, Facing side, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState(); } - public void onPlace(World world, BlockPos pos, State state, EntityLiving placer) { + public void onPlace(World world, LocalPos pos, State state, EntityLiving placer) { } @Serverside - public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, BlockPos pos, Facing side, ItemStack stack) { + public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, LocalPos pos, Facing side, ItemStack stack) { return false; } @@ -1045,7 +1045,7 @@ public class Block { // : !world.getState(pos).getBlock().isOpaqueCube()))))); // } @Clientside - public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) { + public boolean canRender(IWorldAccess world, LocalPos pos, Facing side) { return side == Facing.DOWN && this.minY > 0.0D ? true : (side == Facing.UP && this.maxY < 1.0D ? true : (side == Facing.NORTH && this.minZ > 0.0D ? true @@ -1056,7 +1056,7 @@ public class Block { } @Clientside - public BoundingBox getSelectionBox(World world, BlockPos pos) { + public BoundingBox getSelectionBox(World world, LocalPos pos) { return 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); } @@ -1101,7 +1101,7 @@ public class Block { } @Clientside - public String getInfo(World world, BlockPos pos, State state, EntityNPC player) { + public String getInfo(World world, LocalPos pos, State state, EntityNPC player) { return null; } diff --git a/common/src/main/java/common/block/BlockAir.java b/common/src/main/java/common/block/BlockAir.java index f56e1084..0133f302 100755 --- a/common/src/main/java/common/block/BlockAir.java +++ b/common/src/main/java/common/block/BlockAir.java @@ -1,6 +1,6 @@ package common.block; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.world.State; @@ -11,7 +11,7 @@ public final class BlockAir extends Block { super(Material.NONE); } - public BoundingBox getCollisionBox(World world, BlockPos pos, State state) { + public BoundingBox getCollisionBox(World world, LocalPos pos, State state) { return null; } @@ -23,10 +23,10 @@ public final class BlockAir extends Block { return false; } - public void drop(World world, BlockPos pos, State state, int fortune) { + public void drop(World world, LocalPos pos, State state, int fortune) { } - public boolean canReplace(World world, BlockPos pos) { + public boolean canReplace(World world, LocalPos pos) { return true; } diff --git a/common/src/main/java/common/block/BlockFalling.java b/common/src/main/java/common/block/BlockFalling.java index acf2897f..09e616a9 100755 --- a/common/src/main/java/common/block/BlockFalling.java +++ b/common/src/main/java/common/block/BlockFalling.java @@ -4,7 +4,7 @@ import common.block.natural.BlockFire; import common.entity.item.EntityFalling; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.World; @@ -13,7 +13,7 @@ import common.world.AWorldServer; public class BlockFalling extends Block { public static boolean fallInstantly; - public static boolean canFallInto(World world, BlockPos pos) { + public static boolean canFallInto(World world, LocalPos pos) { Block block = world.getState(pos).getBlock(); return block instanceof BlockFire || block == Blocks.air || block.getMaterial().isLiquid(); } @@ -22,20 +22,20 @@ public class BlockFalling extends Block { super(material); } - public void onAdded(AWorldServer world, BlockPos pos, State state) { + public void onAdded(AWorldServer world, LocalPos pos, State state) { world.scheduleUpdate(pos, this, this.tickRate(world, pos)); } - public void onUpdate(AWorldServer world, BlockPos pos, State state, Block neighbor) { + public void onUpdate(AWorldServer world, LocalPos pos, State state, Block neighbor) { world.scheduleUpdate(pos, this, this.tickRate(world, pos)); } - public void tick(AWorldServer world, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer world, LocalPos pos, State state, Random rand) { if(Vars.blockGravity) this.checkFallable(world, pos); } - private void checkFallable(AWorldServer world, BlockPos pos) { + private void checkFallable(AWorldServer world, LocalPos pos) { if(canFallInto(world, pos.down()) && pos.getY() >= 0) { int range = 32; if(!fallInstantly && world.isAreaLoaded(pos.add(-range, -range, -range), pos.add(range, range, range))) { @@ -48,7 +48,7 @@ public class BlockFalling extends Block { } else { world.setBlockToAir(pos); - BlockPos loc; + LocalPos loc; int limit = 512; for(loc = pos.down(); canFallInto(world, loc) && loc.getY() > -World.MAX_SIZE_Y; loc = loc.down()) { if(--limit <= 0) @@ -60,13 +60,13 @@ public class BlockFalling extends Block { } } - public int tickRate(World world, BlockPos pos) { + public int tickRate(World world, LocalPos pos) { return 2; } protected void onStartFalling(EntityFalling entity) { } - public void onEndFalling(World world, BlockPos pos) { + public void onEndFalling(World world, LocalPos pos) { } } diff --git a/common/src/main/java/common/block/artificial/BlockBed.java b/common/src/main/java/common/block/artificial/BlockBed.java index 14a12c0c..f60db97f 100755 --- a/common/src/main/java/common/block/artificial/BlockBed.java +++ b/common/src/main/java/common/block/artificial/BlockBed.java @@ -14,13 +14,13 @@ import common.model.ModelRotation; import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.util.Facing; import common.util.Identifyable; import common.util.Color; -import common.util.WorldPos; +import common.util.GlobalPos; import common.world.AWorldServer; import common.world.IWorldAccess; import common.world.State; @@ -59,7 +59,7 @@ public class BlockBed extends Block implements Rotatable { this.setBedBounds(); } - public boolean onUse(World world, BlockPos pos, State state, EntityNPC player, Facing side, + public boolean onUse(World world, LocalPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { if(world.client) return true; @@ -72,7 +72,7 @@ public class BlockBed extends Block implements Rotatable { } if(player.isEntityAlive() && Math.abs(player.posX - (double)pos.getX()) <= 3.0D && Math.abs(player.posY - (double)pos.getY()) <= 2.0D && Math.abs(player.posZ - (double)pos.getZ()) <= 3.0D) { - player.setSpawnPoint(new WorldPos(pos, player.worldObj)); + player.setSpawnPoint(new GlobalPos(pos, player.worldObj)); player.connection.addHotbar(Color.DARK_GREEN + "Dein Einstiegspunkt wurde auf %s bei [%s, %s, %s] gesetzt", player.worldObj.dimension.getDisplay(), player.getSpawnPoint().getX(), player.getSpawnPoint().getY(), player.getSpawnPoint().getZ()); @@ -97,11 +97,11 @@ public class BlockBed extends Block implements Rotatable { return false; } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { this.setBedBounds(); } - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) { + public void onUpdate(AWorldServer worldIn, LocalPos 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) @@ -122,7 +122,7 @@ public class BlockBed extends Block implements Rotatable { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5625F, 1.0F); } - public static BlockPos getSafeExitLocation(World worldIn, BlockPos pos, int tries) { + public static LocalPos getSafeExitLocation(World worldIn, LocalPos pos, int tries) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); int i = pos.getX(); int j = pos.getY(); @@ -136,7 +136,7 @@ public class BlockBed extends Block implements Rotatable { for(int i2 = i1; i2 <= k1; ++i2) { for(int j2 = j1; j2 <= l1; ++j2) { - BlockPos blockpos = new BlockPos(i2, j, j2); + LocalPos blockpos = new LocalPos(i2, j, j2); if(hasRoomForPlayer(worldIn, blockpos)) { if(tries <= 0) { @@ -152,12 +152,12 @@ public class BlockBed extends Block implements Rotatable { return null; } - protected static boolean hasRoomForPlayer(World worldIn, BlockPos pos) { + protected static boolean hasRoomForPlayer(World worldIn, LocalPos pos) { return worldIn.isBlockSolid(pos.down()) && !worldIn.getState(pos).getBlock().getMaterial().isSolid() && !worldIn.getState(pos.up()).getBlock().getMaterial().isSolid(); } - public void drop(World worldIn, BlockPos pos, State state, int fortune) { + public void drop(World worldIn, LocalPos pos, State state, int fortune) { if(state.getValue(PART) == BlockBed.EnumPartType.FOOT) super.drop(worldIn, pos, state, fortune); } @@ -203,7 +203,7 @@ public class BlockBed extends Block implements Rotatable { return StackSize.S; } - public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -226,7 +226,7 @@ public class BlockBed extends Block implements Rotatable { int i = ExtMath.floord((double)(playerIn.rotYaw * 4.0F / 360.0F) + 0.5D) & 3; Facing enumfacing = Facing.getHorizontal(i); - BlockPos blockpos = pos.offset(enumfacing); + LocalPos blockpos = pos.offset(enumfacing); if (playerIn.canPlayerEdit(pos, side, stack) && playerIn.canPlayerEdit(blockpos, side, stack)) { @@ -260,7 +260,7 @@ public class BlockBed extends Block implements Rotatable { } @Clientside - public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) + public boolean checkPlace(World worldIn, LocalPos pos, Facing side, EntityNPC player, ItemStack stack) { return side == Facing.UP; } diff --git a/common/src/main/java/common/block/artificial/BlockCake.java b/common/src/main/java/common/block/artificial/BlockCake.java index 978fe63e..4b141112 100755 --- a/common/src/main/java/common/block/artificial/BlockCake.java +++ b/common/src/main/java/common/block/artificial/BlockCake.java @@ -6,7 +6,7 @@ import common.entity.npc.EntityNPC; import common.init.SoundEvent; import common.model.Model; import common.model.Model.ModelProvider; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.AWorldServer; import common.world.State; @@ -32,30 +32,30 @@ public class BlockCake extends Block return false; } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { this.eatCake(worldIn, pos, state, playerIn); return true; } - public void onStartBreak(World worldIn, BlockPos pos, EntityNPC playerIn) + public void onStartBreak(World worldIn, LocalPos pos, EntityNPC playerIn) { this.eatCake(worldIn, pos, worldIn.getState(pos), playerIn); } - private void eatCake(World worldIn, BlockPos pos, State state, EntityNPC player) + private void eatCake(World worldIn, LocalPos pos, State state, EntityNPC player) { worldIn.setBlockToAir(pos); worldIn.playSoundAtEntity(player, SoundEvent.EAT, 0.5F); player.heal((int)((float)6 * 0.5f * (1.0f + worldIn.rand.floatv()))); } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos); } - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!this.canBlockStay(worldIn, pos)) { @@ -63,7 +63,7 @@ public class BlockCake extends Block } } - private boolean canBlockStay(World worldIn, BlockPos pos) + private boolean canBlockStay(World worldIn, LocalPos pos) { return worldIn.getState(pos.down()).getBlock().getMaterial().isSolid(); } diff --git a/common/src/main/java/common/block/artificial/BlockCarpet.java b/common/src/main/java/common/block/artificial/BlockCarpet.java index 3235be33..ca75ddee 100755 --- a/common/src/main/java/common/block/artificial/BlockCarpet.java +++ b/common/src/main/java/common/block/artificial/BlockCarpet.java @@ -5,7 +5,7 @@ import common.block.Material; import common.item.CheatTab; import common.model.Model; import common.model.Model.ModelProvider; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Color; import common.world.AWorldServer; @@ -51,7 +51,7 @@ public class BlockCarpet extends Block return false; } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { this.setBlockBoundsFromMeta(); } @@ -63,7 +63,7 @@ public class BlockCarpet extends Block this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos); } @@ -71,12 +71,12 @@ public class BlockCarpet extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { this.checkForDrop(worldIn, pos, state); } - private boolean checkForDrop(World worldIn, BlockPos pos, State state) + private boolean checkForDrop(World worldIn, LocalPos pos, State state) { if (!this.canBlockStay(worldIn, pos)) { @@ -90,12 +90,12 @@ public class BlockCarpet extends Block } } - private boolean canBlockStay(World worldIn, BlockPos pos) + private boolean canBlockStay(World worldIn, LocalPos pos) { return !worldIn.isAirBlock(pos.down()); } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return side == Facing.UP ? true : super.canRender(worldIn, pos, side); } diff --git a/common/src/main/java/common/block/artificial/BlockDoor.java b/common/src/main/java/common/block/artificial/BlockDoor.java index d35d5d25..2d5230fd 100755 --- a/common/src/main/java/common/block/artificial/BlockDoor.java +++ b/common/src/main/java/common/block/artificial/BlockDoor.java @@ -21,7 +21,7 @@ import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyEnum; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.Facing; @@ -86,7 +86,7 @@ public class BlockDoor extends Block implements Rotatable { return false; } - public boolean isPassable(IBlockAccess world, BlockPos pos) { + public boolean isPassable(IBlockAccess world, LocalPos pos) { return world.getState(pos).getValue(OPEN); } @@ -95,17 +95,17 @@ public class BlockDoor extends Block implements Rotatable { } @Clientside - public BoundingBox getSelectionBox(World world, BlockPos pos) { + public BoundingBox getSelectionBox(World world, LocalPos pos) { this.setBlockBounds(world, pos); return super.getSelectionBox(world, pos); } - public BoundingBox getCollisionBox(World world, BlockPos pos, State state) { + public BoundingBox getCollisionBox(World world, LocalPos pos, State state) { this.setBlockBounds(world, pos); return super.getCollisionBox(world, pos, state); } - public void setBlockBounds(IWorldAccess world, BlockPos pos) { + public void setBlockBounds(IWorldAccess world, LocalPos pos) { float thick = 0.1875F; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); State state = world.getState(pos); @@ -161,11 +161,11 @@ public class BlockDoor extends Block implements Rotatable { } } - public boolean onUse(World world, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World world, LocalPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { if(this.keyItem != null && (player.getHeldItem() == null || player.getHeldItem().getItem() != this.keyItem)) return true; - BlockPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down(); - BlockPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up(); + LocalPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down(); + LocalPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up(); State bottom = pos.equals(lower) ? state : world.getState(lower); State top = pos.equals(upper) ? state : world.getState(upper); if(bottom.getBlock() != this || top.getBlock() != this) @@ -178,11 +178,11 @@ public class BlockDoor extends Block implements Rotatable { return true; } - public void toggleDoor(World world, BlockPos pos, boolean open) { + public void toggleDoor(World world, LocalPos pos, boolean open) { State state = world.getState(pos); if(state.getBlock() == this) { - BlockPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down(); - BlockPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up(); + LocalPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down(); + LocalPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up(); State bottom = pos.equals(lower) ? state : world.getState(lower); State top = pos.equals(upper) ? state : world.getState(upper); if(bottom.getBlock() == this && top.getBlock() == this && ((open != bottom.getValue(OPEN)) || (open != top.getValue(OPEN)))) { @@ -194,9 +194,9 @@ public class BlockDoor extends Block implements Rotatable { } } - public void onUpdate(AWorldServer world, BlockPos pos, State state, Block neighbor) { + public void onUpdate(AWorldServer world, LocalPos pos, State state, Block neighbor) { if(state.getValue(HALF) == EnumDoorHalf.UPPER) { - BlockPos lower = pos.down(); + LocalPos lower = pos.down(); State bottom = world.getState(lower); if(bottom.getBlock() != this) { @@ -208,7 +208,7 @@ public class BlockDoor extends Block implements Rotatable { } else { boolean wrong = false; - BlockPos upper = pos.up(); + LocalPos upper = pos.up(); State top = world.getState(upper); if(top.getBlock() != this) { @@ -237,12 +237,12 @@ public class BlockDoor extends Block implements Rotatable { return state.getValue(HALF) == EnumDoorHalf.UPPER ? null : super.getDrop(state, rand, fortune); } - public HitPosition rayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) { + public HitPosition rayTrace(World world, LocalPos pos, Vec3 start, Vec3 end) { this.setBlockBounds(world, pos); return super.rayTrace(world, pos, start, end); } - public boolean canPlace(World world, BlockPos pos) { + public boolean canPlace(World world, LocalPos pos) { return pos.getY() < World.MAX_SIZE_Y - 1 && world.isBlockSolid(pos.down()) && super.canPlace(world, pos) && super.canPlace(world, pos.up()); } @@ -250,7 +250,7 @@ public class BlockDoor extends Block implements Rotatable { return 1; } - public static Facing getFacing(IBlockAccess world, BlockPos pos) { + public static Facing getFacing(IBlockAccess world, LocalPos pos) { return world.getState(pos).getValue(FACING); } @@ -303,7 +303,7 @@ public class BlockDoor extends Block implements Rotatable { return StackSize.S; } - public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (side != Facing.UP) { @@ -337,15 +337,15 @@ public class BlockDoor extends Block implements Rotatable { } @Clientside - public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) + public boolean checkPlace(World worldIn, LocalPos pos, Facing side, EntityNPC player, ItemStack stack) { return side == Facing.UP; } - public static void placeDoor(World worldIn, BlockPos pos, Facing facing, Block door, boolean update) + public static void placeDoor(World worldIn, LocalPos pos, Facing facing, Block door, boolean update) { - BlockPos blockpos = pos.offset(facing.rotateY()); - BlockPos blockpos1 = pos.offset(facing.rotateYCCW()); + LocalPos blockpos = pos.offset(facing.rotateY()); + LocalPos blockpos1 = pos.offset(facing.rotateYCCW()); int i = (worldIn.getState(blockpos1).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getState(blockpos1.up()).getBlock().isNormalCube() ? 1 : 0); int j = (worldIn.getState(blockpos).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getState(blockpos.up()).getBlock().isNormalCube() ? 1 : 0); boolean flag = worldIn.getState(blockpos1).getBlock() == door || worldIn.getState(blockpos1.up()).getBlock() == door; @@ -357,7 +357,7 @@ public class BlockDoor extends Block implements Rotatable { flag2 = true; } - BlockPos blockpos2 = pos.up(); + LocalPos blockpos2 = pos.up(); 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); diff --git a/common/src/main/java/common/block/artificial/BlockDragonEgg.java b/common/src/main/java/common/block/artificial/BlockDragonEgg.java index d0f07b0a..b7f24c99 100755 --- a/common/src/main/java/common/block/artificial/BlockDragonEgg.java +++ b/common/src/main/java/common/block/artificial/BlockDragonEgg.java @@ -9,7 +9,7 @@ import common.init.Blocks; import common.model.Model; import common.model.Model.ModelProvider; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.ParticleType; import common.vars.Vars; @@ -26,7 +26,7 @@ public class BlockDragonEgg extends Block this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F); } - public void onAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, LocalPos pos, State state) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos)); } @@ -34,18 +34,18 @@ public class BlockDragonEgg extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos)); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.blockGravity) this.checkFall(worldIn, pos); } - private void checkFall(AWorldServer worldIn, BlockPos pos) + private void checkFall(AWorldServer worldIn, LocalPos pos) { if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0) { @@ -58,7 +58,7 @@ public class BlockDragonEgg extends Block else { worldIn.setBlockToAir(pos); - BlockPos blockpos; + LocalPos blockpos; for(blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down()) { } if(blockpos != pos) @@ -69,18 +69,18 @@ public class BlockDragonEgg extends Block } } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { this.teleport(worldIn, pos); return true; } - public void onStartBreak(World worldIn, BlockPos pos, EntityNPC playerIn) + public void onStartBreak(World worldIn, LocalPos pos, EntityNPC playerIn) { this.teleport(worldIn, pos); } - private void teleport(World worldIn, BlockPos pos) + private void teleport(World worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos); @@ -88,7 +88,7 @@ public class BlockDragonEgg extends Block { for (int i = 0; i < 1000; ++i) { - BlockPos blockpos = pos.add(worldIn.rand.zrange(16) - worldIn.rand.zrange(16), worldIn.rand.zrange(8) - worldIn.rand.zrange(8), worldIn.rand.zrange(16) - worldIn.rand.zrange(16)); + LocalPos blockpos = pos.add(worldIn.rand.zrange(16) - worldIn.rand.zrange(16), worldIn.rand.zrange(8) - worldIn.rand.zrange(8), worldIn.rand.zrange(16) - worldIn.rand.zrange(16)); if (worldIn.getState(blockpos).getBlock() == Blocks.air) { @@ -107,7 +107,7 @@ public class BlockDragonEgg extends Block { worldIn.setBlockToAir(pos); if(!Vars.blockGravity) { - BlockPos blockpos2; + LocalPos blockpos2; for(blockpos2 = blockpos; BlockFalling.canFallInto(worldIn, blockpos2) && blockpos2.getY() > 0; blockpos2 = blockpos2.down()) { } if(blockpos2 != blockpos) @@ -125,7 +125,7 @@ public class BlockDragonEgg extends Block /** * How many world ticks before ticking */ - public int tickRate(World worldIn, BlockPos pos) + public int tickRate(World worldIn, LocalPos pos) { return 5; } @@ -143,7 +143,7 @@ public class BlockDragonEgg extends Block return false; } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return true; } diff --git a/common/src/main/java/common/block/artificial/BlockFence.java b/common/src/main/java/common/block/artificial/BlockFence.java index eb14ec33..edbe23a5 100755 --- a/common/src/main/java/common/block/artificial/BlockFence.java +++ b/common/src/main/java/common/block/artificial/BlockFence.java @@ -15,7 +15,7 @@ import common.model.ModelRotation; import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyBool; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.world.IBlockAccess; @@ -52,7 +52,7 @@ public class BlockFence extends Block /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { boolean flag = this.canConnectTo(worldIn, pos.north()); boolean flag1 = this.canConnectTo(worldIn, pos.south()); @@ -111,7 +111,7 @@ public class BlockFence extends Block this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3); } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { boolean flag = this.canConnectTo(worldIn, pos.north()); boolean flag1 = this.canConnectTo(worldIn, pos.south()); @@ -158,23 +158,23 @@ public class BlockFence extends Block return false; } - public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + public boolean isPassable(IBlockAccess worldIn, LocalPos pos) { return false; } - public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) + public boolean canConnectTo(IBlockAccess worldIn, LocalPos pos) { Block block = worldIn.getState(pos).getBlock(); return ((!(block instanceof BlockFence) || block.getMaterial() != this.material) && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.SOFT : false) : true); } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return true; } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { return worldIn.client ? true : ItemLead.attachToFence(playerIn, worldIn, pos); } @@ -183,7 +183,7 @@ public class BlockFence extends Block * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { return state.withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west()))); } diff --git a/common/src/main/java/common/block/artificial/BlockFenceGate.java b/common/src/main/java/common/block/artificial/BlockFenceGate.java index 71d761e0..fd0eb81f 100755 --- a/common/src/main/java/common/block/artificial/BlockFenceGate.java +++ b/common/src/main/java/common/block/artificial/BlockFenceGate.java @@ -13,7 +13,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.properties.Property; import common.properties.PropertyBool; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.world.IBlockAccess; @@ -40,7 +40,7 @@ public class BlockFenceGate extends Block implements Rotatable * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { Facing.Axis enumfacing$axis = ((Facing)state.getValue(FACING)).getAxis(); @@ -52,12 +52,12 @@ public class BlockFenceGate extends Block implements Rotatable return state; } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return worldIn.getState(pos.down()).getBlock().getMaterial().isSolid() ? super.canPlace(worldIn, pos) : false; } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { if (((Boolean)state.getValue(OPEN)).booleanValue()) { @@ -70,7 +70,7 @@ public class BlockFenceGate extends Block implements Rotatable } } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { Facing.Axis enumfacing$axis = ((Facing)worldIn.getState(pos).getValue(FACING)).getAxis(); @@ -97,7 +97,7 @@ public class BlockFenceGate extends Block implements Rotatable return false; } - public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + public boolean isPassable(IBlockAccess worldIn, LocalPos pos) { return ((Boolean)worldIn.getState(pos).getValue(OPEN)).booleanValue(); } @@ -106,12 +106,12 @@ public class BlockFenceGate extends Block implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false)); } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (((Boolean)state.getValue(OPEN)).booleanValue()) { @@ -135,7 +135,7 @@ public class BlockFenceGate extends Block implements Rotatable return true; } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return true; } diff --git a/common/src/main/java/common/block/artificial/BlockFloorPortal.java b/common/src/main/java/common/block/artificial/BlockFloorPortal.java index 14c26eca..a5e3fada 100755 --- a/common/src/main/java/common/block/artificial/BlockFloorPortal.java +++ b/common/src/main/java/common/block/artificial/BlockFloorPortal.java @@ -11,7 +11,7 @@ import common.entity.Entity; import common.model.Model; import common.model.Model.ModelProvider; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.ParticleType; @@ -36,7 +36,7 @@ public class BlockFloorPortal extends Block // return new TileEntityPortal(); // } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { this.setBlockBounds(0.0F, 0.6875F, 0.0F, 1.0F, 0.75F, 1.0F); } @@ -49,7 +49,7 @@ public class BlockFloorPortal extends Block /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { } @@ -77,7 +77,7 @@ public class BlockFloorPortal extends Block /** * Called When an Entity Collided with the Block */ - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { // if (entityIn.ridingEntity == null && entityIn.riddenByEntity == null && !worldIn.client && GameServer.getServer().getAllowEnd()) // { @@ -87,7 +87,7 @@ public class BlockFloorPortal extends Block entityIn.setPortal(PortalType.FLOOR); } - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) + public void displayTick(World worldIn, LocalPos pos, State state, Random rand) { double d0 = (double)((float)pos.getX() + rand.floatv()); double d1 = (double)((float)pos.getY() + 0.8F); @@ -103,9 +103,9 @@ public class BlockFloorPortal extends Block // return MapColor.blackColor; // } - private void destroyRecursive(World world, Set positions, BlockPos pos, int limit) { + private void destroyRecursive(World world, Set positions, LocalPos pos, int limit) { for(int n = 0; n < 4; n++) { - BlockPos npos = pos.offset(Facing.getHorizontal(n)); + LocalPos npos = pos.offset(Facing.getHorizontal(n)); if(/* !positions.contains(npos) && */ world.getState(npos).getBlock() == this) { positions.add(npos); if(limit > 0) @@ -114,12 +114,12 @@ public class BlockFloorPortal extends Block } } - public void onBroken(World worldIn, BlockPos pos, State state) + public void onBroken(World worldIn, LocalPos pos, State state) { - Set positions = Sets.newHashSet(); + Set positions = Sets.newHashSet(); positions.add(pos); this.destroyRecursive(worldIn, positions, pos, 10); - for(BlockPos bpos : positions) + for(LocalPos bpos : positions) worldIn.setBlockToAir(bpos); // for(int x = -2; x <= 2; x++) { // for(int z = -2; z <= 2; z++) { diff --git a/common/src/main/java/common/block/artificial/BlockFlowerPot.java b/common/src/main/java/common/block/artificial/BlockFlowerPot.java index 094c6568..891cb014 100755 --- a/common/src/main/java/common/block/artificial/BlockFlowerPot.java +++ b/common/src/main/java/common/block/artificial/BlockFlowerPot.java @@ -16,7 +16,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.model.GuiPosition; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -51,7 +51,7 @@ public class BlockFlowerPot extends Block return false; } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { ItemStack itemstack = playerIn.getHeldItem(); @@ -92,7 +92,7 @@ public class BlockFlowerPot extends Block } } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return super.canPlace(worldIn, pos) && worldIn.isBlockSolid(pos.down()); } @@ -100,7 +100,7 @@ public class BlockFlowerPot extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!worldIn.isBlockSolid(pos.down())) { @@ -109,7 +109,7 @@ public class BlockFlowerPot extends Block } } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { if(this.content != null) dropItem(worldIn, pos, new ItemStack(this.content.getItem())); diff --git a/common/src/main/java/common/block/artificial/BlockGlass.java b/common/src/main/java/common/block/artificial/BlockGlass.java index 53a3d70d..e215ef3d 100755 --- a/common/src/main/java/common/block/artificial/BlockGlass.java +++ b/common/src/main/java/common/block/artificial/BlockGlass.java @@ -5,8 +5,7 @@ import common.block.Material; import common.entity.Entity; import common.item.CheatTab; import common.rng.Random; -import common.util.BlockPos; -import common.util.Clientside; +import common.util.LocalPos; import common.util.Facing; import common.util.Serverside; import common.world.AWorldServer; @@ -35,14 +34,14 @@ public class BlockGlass extends Block { return true; } - public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) { + public boolean canRender(IWorldAccess world, LocalPos pos, Facing side) { State state = world.getState(pos); Block block = state.getBlock(); return world.getState(pos.offset(side.getOpposite())) != state || (block != this && super.canRender(world, pos, side)); } @Serverside - public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) { + public boolean onShot(AWorldServer world, LocalPos pos, State state, Entity projectile) { world.destroyBlock(pos, true); return false; } diff --git a/common/src/main/java/common/block/artificial/BlockHay.java b/common/src/main/java/common/block/artificial/BlockHay.java index 41613c3a..c229ff38 100755 --- a/common/src/main/java/common/block/artificial/BlockHay.java +++ b/common/src/main/java/common/block/artificial/BlockHay.java @@ -5,7 +5,7 @@ import common.block.Material; import common.entity.types.EntityLiving; import common.item.CheatTab; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -25,7 +25,7 @@ public class BlockHay extends BlockRotatedPillar return new Property[] {AXIS}; } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(AXIS, facing.getAxis()); } diff --git a/common/src/main/java/common/block/artificial/BlockLadder.java b/common/src/main/java/common/block/artificial/BlockLadder.java index 10677572..675c1521 100755 --- a/common/src/main/java/common/block/artificial/BlockLadder.java +++ b/common/src/main/java/common/block/artificial/BlockLadder.java @@ -10,7 +10,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.model.GuiPosition; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.world.AWorldServer; @@ -27,19 +27,19 @@ public class BlockLadder extends Block implements Rotatable this.setTab(CheatTab.WOOD); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { this.setBlockBounds(worldIn, pos); return super.getCollisionBox(worldIn, pos, state); } - public BoundingBox getSelectionBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, LocalPos pos) { this.setBlockBounds(worldIn, pos); return super.getSelectionBox(worldIn, pos); } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos); @@ -81,7 +81,7 @@ public class BlockLadder extends Block implements Rotatable return false; } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return worldIn.getState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getState(pos.south()).getBlock().isNormalCube())); } @@ -90,7 +90,7 @@ public class BlockLadder extends Block implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { if (facing.getAxis().isHorizontal() && this.canBlockStay(worldIn, pos, facing)) { @@ -113,7 +113,7 @@ public class BlockLadder extends Block implements Rotatable /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { Facing enumfacing = (Facing)state.getValue(FACING); @@ -126,7 +126,7 @@ public class BlockLadder extends Block implements Rotatable super.onUpdate(worldIn, pos, state, neighborBlock); } - protected boolean canBlockStay(World worldIn, BlockPos pos, Facing facing) + protected boolean canBlockStay(World worldIn, LocalPos pos, Facing facing) { return worldIn.getState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); } diff --git a/common/src/main/java/common/block/artificial/BlockMetalBlock.java b/common/src/main/java/common/block/artificial/BlockMetalBlock.java index 33544409..13e36254 100644 --- a/common/src/main/java/common/block/artificial/BlockMetalBlock.java +++ b/common/src/main/java/common/block/artificial/BlockMetalBlock.java @@ -11,7 +11,6 @@ import common.entity.npc.EntityNPC; import common.init.MetalType; import common.item.CheatTab; import common.item.ItemStack; -import common.util.Clientside; public class BlockMetalBlock extends Block { private final MetalType metal; diff --git a/common/src/main/java/common/block/artificial/BlockPane.java b/common/src/main/java/common/block/artificial/BlockPane.java index 1ec347a9..caf24189 100755 --- a/common/src/main/java/common/block/artificial/BlockPane.java +++ b/common/src/main/java/common/block/artificial/BlockPane.java @@ -15,9 +15,8 @@ import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; -import common.util.Clientside; import common.util.Facing; import common.util.Serverside; import common.world.AWorldServer; @@ -43,7 +42,7 @@ public class BlockPane extends Block * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.east()).getBlock()))); } @@ -69,7 +68,7 @@ public class BlockPane extends Block return false; } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return worldIn.getState(pos).getBlock() == this ? false : super.canRender(worldIn, pos, side); } @@ -77,7 +76,7 @@ public class BlockPane extends Block /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { boolean flag = this.canPaneConnectToBlock(worldIn.getState(pos.north()).getBlock()); boolean flag1 = this.canPaneConnectToBlock(worldIn.getState(pos.south()).getBlock()); @@ -123,7 +122,7 @@ public class BlockPane extends Block } } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { float f = 0.4375F; float f1 = 0.5625F; @@ -191,7 +190,7 @@ public class BlockPane extends Block } @Serverside - public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) { + public boolean onShot(AWorldServer world, LocalPos pos, State state, Entity projectile) { if(this.material != Material.SOLID) world.destroyBlock(pos, true); return this.material == Material.SOLID; diff --git a/common/src/main/java/common/block/artificial/BlockPortal.java b/common/src/main/java/common/block/artificial/BlockPortal.java index c0c073bb..5f0adcca 100755 --- a/common/src/main/java/common/block/artificial/BlockPortal.java +++ b/common/src/main/java/common/block/artificial/BlockPortal.java @@ -12,7 +12,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.ParticleType; @@ -72,12 +72,12 @@ public class BlockPortal extends Block // } // } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { Facing.Axis enumfacing$axis = (Facing.Axis)worldIn.getState(pos).getValue(AXIS); float f = 0.125F; @@ -110,7 +110,7 @@ public class BlockPortal extends Block return false; } - public boolean tryIgnitePortal(World worldIn, BlockPos pos) + public boolean tryIgnitePortal(World worldIn, LocalPos pos) { BlockPortal.Size size = new BlockPortal.Size(worldIn, pos, Facing.Axis.X, this); @@ -138,7 +138,7 @@ public class BlockPortal extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { Facing.Axis enumfacing$axis = (Facing.Axis)state.getValue(AXIS); @@ -162,7 +162,7 @@ public class BlockPortal extends Block } } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { Facing.Axis enumfacing$axis = null; State iblockstate = worldIn.getState(pos); @@ -207,7 +207,7 @@ public class BlockPortal extends Block /** * Called When an Entity Collided with the Block */ - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { if (entityIn.vehicle == null && entityIn.passenger == null) { @@ -215,7 +215,7 @@ public class BlockPortal extends Block } } - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) + public void displayTick(World worldIn, LocalPos pos, State state, Random rand) { // if (rand.chance(100)) // { @@ -327,11 +327,11 @@ public class BlockPortal extends Block private final Facing field_150863_d; private final BlockPortal dim; private int field_150864_e = 0; - private BlockPos field_150861_f; + private LocalPos field_150861_f; private int height; private int field_150868_h; - public Size(World worldIn, BlockPos p_i45694_2_, Facing.Axis p_i45694_3_, BlockPortal dim) + public Size(World worldIn, LocalPos p_i45694_2_, Facing.Axis p_i45694_3_, BlockPortal dim) { this.world = worldIn; this.dim = dim; @@ -348,7 +348,7 @@ public class BlockPortal extends Block this.field_150866_c = Facing.SOUTH; } - for (BlockPos blockpos = p_i45694_2_; p_i45694_2_.getY() > blockpos.getY() - 21 && p_i45694_2_.getY() > 0 && this.func_150857_a(worldIn.getState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down()) + for (LocalPos blockpos = p_i45694_2_; p_i45694_2_.getY() > blockpos.getY() - 21 && p_i45694_2_.getY() > 0 && this.func_150857_a(worldIn.getState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down()) { ; } @@ -373,13 +373,13 @@ public class BlockPortal extends Block } } - protected int func_180120_a(BlockPos p_180120_1_, Facing p_180120_2_) + protected int func_180120_a(LocalPos p_180120_1_, Facing p_180120_2_) { int i; for (i = 0; i < 22; ++i) { - BlockPos blockpos = p_180120_1_.offset(p_180120_2_, i); + LocalPos blockpos = p_180120_1_.offset(p_180120_2_, i); if (!this.func_150857_a(this.world.getState(blockpos).getBlock()) || this.world.getState(blockpos.down()).getBlock() != Blocks.obsidian) { @@ -409,7 +409,7 @@ public class BlockPortal extends Block { for (int i = 0; i < this.field_150868_h; ++i) { - BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.height); + LocalPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.height); Block block = this.world.getState(blockpos).getBlock(); if (!this.func_150857_a(block)) @@ -479,7 +479,7 @@ public class BlockPortal extends Block { for (int i = 0; i < this.field_150868_h; ++i) { - BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i); + LocalPos blockpos = this.field_150861_f.offset(this.field_150866_c, i); State state = this.dim.getState().withProperty(BlockPortal.AXIS, this.axis); for (int j = 0; j < this.height; ++j) diff --git a/common/src/main/java/common/block/artificial/BlockPortalFrame.java b/common/src/main/java/common/block/artificial/BlockPortalFrame.java index 39ce5925..9b24b724 100755 --- a/common/src/main/java/common/block/artificial/BlockPortalFrame.java +++ b/common/src/main/java/common/block/artificial/BlockPortalFrame.java @@ -19,7 +19,7 @@ import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.world.State; @@ -46,7 +46,7 @@ public class BlockPortalFrame extends Block implements Rotatable /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); @@ -73,7 +73,7 @@ public class BlockPortalFrame extends Block implements Rotatable return 4; } - public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te) { super.postBroken(worldIn, player, pos, state, te); if(state.getValue(ORB)) @@ -84,7 +84,7 @@ public class BlockPortalFrame extends Block implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(ORB, Boolean.valueOf(false)); } @@ -94,10 +94,10 @@ public class BlockPortalFrame extends Block implements Rotatable return new Property[] {FACING, ORB}; } - public void onBroken(World worldIn, BlockPos pos, State state) + public void onBroken(World worldIn, LocalPos pos, State state) { for(int n = 0; n < 4; n++) { - BlockPos ppos = pos.offset(Facing.getHorizontal(n)); + LocalPos ppos = pos.offset(Facing.getHorizontal(n)); State pstate = worldIn.getState(ppos); if(pstate.getBlock() == Blocks.floor_portal) Blocks.floor_portal.onBroken(worldIn, ppos, pstate); diff --git a/common/src/main/java/common/block/artificial/BlockQuartzPillar.java b/common/src/main/java/common/block/artificial/BlockQuartzPillar.java index cccba048..4e17156b 100644 --- a/common/src/main/java/common/block/artificial/BlockQuartzPillar.java +++ b/common/src/main/java/common/block/artificial/BlockQuartzPillar.java @@ -8,7 +8,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -23,7 +23,7 @@ public class BlockQuartzPillar extends BlockRotatedPillar { this.texture = texture; } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(AXIS, facing.getAxis()); } diff --git a/common/src/main/java/common/block/artificial/BlockSkull.java b/common/src/main/java/common/block/artificial/BlockSkull.java index 0fff3d87..074d2484 100755 --- a/common/src/main/java/common/block/artificial/BlockSkull.java +++ b/common/src/main/java/common/block/artificial/BlockSkull.java @@ -10,7 +10,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.model.GuiPosition; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Serverside; import common.world.AWorldServer; @@ -24,11 +24,11 @@ public class BlockSkull extends Block implements Rotatable { this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); } - public boolean canPlace(World world, BlockPos pos) { + public boolean canPlace(World world, LocalPos pos) { return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down()); } - public State getPlacedState(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World world, LocalPos pos, Facing face, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } @@ -54,7 +54,7 @@ public class BlockSkull extends Block implements Rotatable { } @Serverside - public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) { + public boolean onShot(AWorldServer world, LocalPos pos, State state, Entity projectile) { world.destroyBlock(pos, true); return true; } diff --git a/common/src/main/java/common/block/artificial/BlockSlab.java b/common/src/main/java/common/block/artificial/BlockSlab.java index 2dafad1a..cce2124e 100755 --- a/common/src/main/java/common/block/artificial/BlockSlab.java +++ b/common/src/main/java/common/block/artificial/BlockSlab.java @@ -15,7 +15,7 @@ import common.model.Model; import common.model.ModelRotation; import common.model.Model.ModelProvider; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.Facing.Axis; @@ -67,12 +67,12 @@ public class BlockSlab extends Block implements Directional { return new Property[] {FACING}; } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = this.getState().withProperty(FACING, Facing.DOWN); return facing != Facing.DOWN && (facing == Facing.UP || (double)hitY <= 0.5D) ? iblockstate : iblockstate.withProperty(FACING, Facing.UP); } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos); if(iblockstate.getBlock() == this) { @@ -99,7 +99,7 @@ public class BlockSlab extends Block implements Directional { } } - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(worldIn, pos); super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } @@ -116,14 +116,14 @@ public class BlockSlab extends Block implements Directional { return blockIn instanceof BlockSlab; } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { State iblockstate = worldIn.getState(pos); if(iblockstate.getBlock() == this && iblockstate.getValue(FACING).getAxis() == Axis.Y) { if(side != Facing.UP && side != Facing.DOWN && !super.canRender(worldIn, pos, side)) { return false; } else { - BlockPos blockpos = pos.offset(side.getOpposite()); + LocalPos blockpos = pos.offset(side.getOpposite()); State iblockstate1 = worldIn.getState(blockpos); if(isSlab(iblockstate1.getBlock()) && iblockstate.getValue(FACING).getAxis() == Axis.Y) return true; @@ -178,12 +178,12 @@ public class BlockSlab extends Block implements Directional { return true; } - public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { + public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { return !stack.isEmpty() && playerIn.canPlayerEdit(pos.offset(side), side, stack) && (this.tryVerticalPlace(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ) || super.place(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ)); } - private boolean tryVerticalPlace(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { + private boolean tryVerticalPlace(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if(hitY >= 0.34f && hitY <= 0.66f) { State state = worldIn.getState(pos); Block block = state.getBlock(); diff --git a/common/src/main/java/common/block/artificial/BlockStairs.java b/common/src/main/java/common/block/artificial/BlockStairs.java index 81525fe4..4bc214d9 100755 --- a/common/src/main/java/common/block/artificial/BlockStairs.java +++ b/common/src/main/java/common/block/artificial/BlockStairs.java @@ -14,7 +14,7 @@ import common.model.Model.ModelProvider; import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyEnum; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.HitPosition; @@ -62,7 +62,7 @@ public class BlockStairs extends Block implements Rotatable this.sideTex = side; } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { if (this.hasRaytraced) { @@ -90,7 +90,7 @@ public class BlockStairs extends Block implements Rotatable /** * Set the block bounds as the collision bounds for the stairs at the given position */ - public void setBaseCollisionBounds(IBlockAccess worldIn, BlockPos pos) + public void setBaseCollisionBounds(IBlockAccess worldIn, LocalPos pos) { if (worldIn.getState(pos).getValue(HALF) == BlockStairs.EnumHalf.TOP) { @@ -113,14 +113,14 @@ public class BlockStairs extends Block implements Rotatable /** * Check whether there is a stair block at the given position and it has the same properties as the given BlockState */ - public static boolean isSameStair(IBlockAccess worldIn, BlockPos pos, State state) + public static boolean isSameStair(IBlockAccess worldIn, LocalPos pos, State state) { State iblockstate = worldIn.getState(pos); Block block = iblockstate.getBlock(); return isBlockStairs(block) && iblockstate.getValue(HALF) == state.getValue(HALF) && iblockstate.getValue(FACING) == state.getValue(FACING); } - public int getOuterShape(IBlockAccess blockAccess, BlockPos pos) + public int getOuterShape(IBlockAccess blockAccess, LocalPos pos) { State iblockstate = blockAccess.getState(pos); Facing enumfacing = (Facing)iblockstate.getValue(FACING); @@ -211,7 +211,7 @@ public class BlockStairs extends Block implements Rotatable return 0; } - public int getInnerShape(IBlockAccess blockAccess, BlockPos pos) + public int getInnerShape(IBlockAccess blockAccess, LocalPos pos) { State iblockstate = blockAccess.getState(pos); Facing enumfacing = (Facing)iblockstate.getValue(FACING); @@ -302,7 +302,7 @@ public class BlockStairs extends Block implements Rotatable return 0; } - public boolean setBaseBlockBounds(IBlockAccess blockAccess, BlockPos pos) + public boolean setBaseBlockBounds(IBlockAccess blockAccess, LocalPos pos) { State iblockstate = blockAccess.getState(pos); Facing enumfacing = (Facing)iblockstate.getValue(FACING); @@ -418,7 +418,7 @@ public class BlockStairs extends Block implements Rotatable return flag1; } - public boolean setCollisionBlockBounds(IBlockAccess blockAccess, BlockPos pos) + public boolean setCollisionBlockBounds(IBlockAccess blockAccess, LocalPos pos) { State iblockstate = blockAccess.getState(pos); Facing enumfacing = (Facing)iblockstate.getValue(FACING); @@ -543,7 +543,7 @@ public class BlockStairs extends Block implements Rotatable /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBaseCollisionBounds(worldIn, pos); super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); @@ -562,7 +562,7 @@ public class BlockStairs extends Block implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer); iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing()).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT); @@ -572,7 +572,7 @@ public class BlockStairs extends Block implements Rotatable /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. */ - public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public HitPosition rayTrace(World worldIn, LocalPos pos, Vec3 start, Vec3 end) { HitPosition[] amovingobjectposition = new HitPosition[8]; State iblockstate = worldIn.getState(pos); @@ -603,7 +603,7 @@ public class BlockStairs extends Block implements Rotatable { if (movingobjectposition != null) { - double d0 = movingobjectposition.vec.squareDistanceTo(end); + double d0 = movingobjectposition.vec.distanceSq(end); if (d0 > d1) { @@ -620,7 +620,7 @@ public class BlockStairs extends Block implements Rotatable * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { if (this.setBaseBlockBounds(worldIn, pos)) { diff --git a/common/src/main/java/common/block/artificial/BlockTrapDoor.java b/common/src/main/java/common/block/artificial/BlockTrapDoor.java index 8fd5bcc0..eda667d7 100755 --- a/common/src/main/java/common/block/artificial/BlockTrapDoor.java +++ b/common/src/main/java/common/block/artificial/BlockTrapDoor.java @@ -13,7 +13,7 @@ import common.model.ModelRotation; import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyEnum; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.HitPosition; @@ -62,24 +62,24 @@ public class BlockTrapDoor extends Block implements Rotatable return false; } - public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + public boolean isPassable(IBlockAccess worldIn, LocalPos pos) { return !((Boolean)worldIn.getState(pos).getValue(OPEN)).booleanValue(); } - public BoundingBox getSelectionBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, LocalPos pos) { this.setBlockBounds(worldIn, pos); return super.getSelectionBox(worldIn, pos); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { this.setBlockBounds(worldIn, pos); return super.getCollisionBox(worldIn, pos, state); } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { this.setBounds(worldIn.getState(pos)); } @@ -127,7 +127,7 @@ public class BlockTrapDoor extends Block implements Rotatable } } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { if(this.keyItem != null && (player.getHeldItem() == null || player.getHeldItem().getItem() != this.keyItem)) return true; @@ -140,7 +140,7 @@ public class BlockTrapDoor extends Block implements Rotatable /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. */ - public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public HitPosition rayTrace(World worldIn, LocalPos pos, Vec3 start, Vec3 end) { this.setBlockBounds(worldIn, pos); return super.rayTrace(worldIn, pos, start, end); @@ -150,7 +150,7 @@ public class BlockTrapDoor extends Block implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = this.getState(); diff --git a/common/src/main/java/common/block/artificial/BlockWall.java b/common/src/main/java/common/block/artificial/BlockWall.java index 08f9a0ef..4bef6a4a 100755 --- a/common/src/main/java/common/block/artificial/BlockWall.java +++ b/common/src/main/java/common/block/artificial/BlockWall.java @@ -12,7 +12,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.properties.Property; import common.properties.PropertyBool; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.world.IBlockAccess; @@ -58,7 +58,7 @@ public class BlockWall extends Block return false; } - public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + public boolean isPassable(IBlockAccess worldIn, LocalPos pos) { return false; } @@ -71,7 +71,7 @@ public class BlockWall extends Block return false; } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { boolean flag = this.canConnectTo(worldIn, pos.north()); boolean flag1 = this.canConnectTo(worldIn, pos.south()); @@ -119,20 +119,20 @@ public class BlockWall extends Block this.setBlockBounds(f, 0.0F, f2, f1, f4, f3); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { this.setBlockBounds(worldIn, pos); this.maxY = 1.5D; return super.getCollisionBox(worldIn, pos, state); } - public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) + public boolean canConnectTo(IBlockAccess worldIn, LocalPos pos) { Block block = worldIn.getState(pos).getBlock(); return (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.SOFT : false) : true); } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return side == Facing.DOWN ? super.canRender(worldIn, pos, side) : true; } @@ -141,7 +141,7 @@ public class BlockWall extends Block * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock() != Blocks.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west()))); } diff --git a/common/src/main/java/common/block/foliage/BlockBlackenedSoil.java b/common/src/main/java/common/block/foliage/BlockBlackenedSoil.java index ab77347e..6df85331 100644 --- a/common/src/main/java/common/block/foliage/BlockBlackenedSoil.java +++ b/common/src/main/java/common/block/foliage/BlockBlackenedSoil.java @@ -8,7 +8,7 @@ import common.item.Item; import common.model.Model; import common.model.Model.ModelProvider; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.AWorldServer; @@ -22,7 +22,7 @@ public class BlockBlackenedSoil extends Block this.setTab(CheatTab.NATURE); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (worldIn.getState(pos.up()).getBlock().getLightOpacity() > 6) { @@ -33,7 +33,7 @@ public class BlockBlackenedSoil extends Block { for (int i = 0; i < 4; i++) { - BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1); + LocalPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1); Block block = worldIn.getState(blockpos.up()).getBlock(); State iblockstate = worldIn.getState(blockpos); diff --git a/common/src/main/java/common/block/foliage/BlockBlueShroom.java b/common/src/main/java/common/block/foliage/BlockBlueShroom.java index cc7b249d..959105e2 100755 --- a/common/src/main/java/common/block/foliage/BlockBlueShroom.java +++ b/common/src/main/java/common/block/foliage/BlockBlueShroom.java @@ -6,7 +6,8 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.model.GuiPosition; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; +import common.util.MutablePos; import common.vars.Vars; import common.world.State; import common.world.World; @@ -21,14 +22,14 @@ public class BlockBlueShroom extends BlockBush this.setTicked(); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (Vars.blueShroomGrowth > 0 && rand.chance(Vars.blueShroomGrowth)) { int i = 5; int j = 4; - for (BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add(-4, -1, -4), pos.add(4, 1, 4))) + for (LocalPos blockpos : MutablePos.mutableArea(pos.add(-4, -1, -4), pos.add(4, 1, 4))) { if (worldIn.getState(blockpos).getBlock() == this) { @@ -41,7 +42,7 @@ public class BlockBlueShroom extends BlockBush } } - BlockPos blockpos1 = pos.add(rand.zrange(3) - 1, rand.zrange(2) - rand.zrange(2), rand.zrange(3) - 1); + LocalPos blockpos1 = pos.add(rand.zrange(3) - 1, rand.zrange(2) - rand.zrange(2), rand.zrange(3) - 1); for (int k = 0; k < 4; ++k) { @@ -60,7 +61,7 @@ public class BlockBlueShroom extends BlockBush } } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState()); } @@ -70,7 +71,7 @@ public class BlockBlueShroom extends BlockBush return ground.isFullBlock(); } - public boolean canBlockStay(World worldIn, BlockPos pos, State state) + public boolean canBlockStay(World worldIn, LocalPos pos, State state) { if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { diff --git a/common/src/main/java/common/block/foliage/BlockBush.java b/common/src/main/java/common/block/foliage/BlockBush.java index 6cc65fc9..100024f7 100755 --- a/common/src/main/java/common/block/foliage/BlockBush.java +++ b/common/src/main/java/common/block/foliage/BlockBush.java @@ -6,7 +6,7 @@ import common.init.Blocks; import common.item.CheatTab; import common.model.Model; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.Facing; @@ -30,7 +30,7 @@ public class BlockBush extends Block this.setTab(CheatTab.PLANTS); } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return super.canPlace(worldIn, pos) && this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); } @@ -46,18 +46,18 @@ public class BlockBush extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { super.onUpdate(worldIn, pos, state, neighborBlock); this.checkAndDropBlock(worldIn, pos, state); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { this.checkAndDropBlock(worldIn, pos, state); } - protected void checkAndDropBlock(World worldIn, BlockPos pos, State state) + protected void checkAndDropBlock(World worldIn, LocalPos pos, State state) { if (!this.canBlockStay(worldIn, pos, state)) { @@ -66,12 +66,12 @@ public class BlockBush extends Block } } - public boolean canBlockStay(World worldIn, BlockPos pos, State state) + public boolean canBlockStay(World worldIn, LocalPos pos, State state) { return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } diff --git a/common/src/main/java/common/block/foliage/BlockCactus.java b/common/src/main/java/common/block/foliage/BlockCactus.java index 7b0ff364..d62257dd 100755 --- a/common/src/main/java/common/block/foliage/BlockCactus.java +++ b/common/src/main/java/common/block/foliage/BlockCactus.java @@ -11,7 +11,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.vars.Vars; @@ -31,9 +31,9 @@ public class BlockCactus extends Block this.setTab(CheatTab.PLANTS); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { - BlockPos blockpos = pos.up(); + LocalPos blockpos = pos.up(); if (Vars.cactusHeight > 0 && worldIn.isAirBlock(blockpos)) { @@ -63,13 +63,13 @@ public class BlockCactus extends Block } } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { float f = 0.0625F; return new BoundingBox((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)((float)(pos.getY() + 1) - f), (double)((float)(pos.getZ() + 1) - f)); } - public BoundingBox getSelectionBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, LocalPos pos) { float f = 0.0625F; return new BoundingBox((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)(pos.getY() + 1), (double)((float)(pos.getZ() + 1) - f)); @@ -88,7 +88,7 @@ public class BlockCactus extends Block return false; } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return super.canPlace(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false; } @@ -96,7 +96,7 @@ public class BlockCactus extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!this.canBlockStay(worldIn, pos)) { @@ -104,7 +104,7 @@ public class BlockCactus extends Block } } - public boolean canBlockStay(World worldIn, BlockPos pos) + public boolean canBlockStay(World worldIn, LocalPos pos) { for (Facing enumfacing : Facing.Plane.HORIZONTAL) { @@ -121,7 +121,7 @@ public class BlockCactus extends Block /** * Called When an Entity Collided with the Block */ - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { if(worldIn.client || Vars.cactusDamage) entityIn.attackEntityFrom(DamageSource.cactus, 1); diff --git a/common/src/main/java/common/block/foliage/BlockCrops.java b/common/src/main/java/common/block/foliage/BlockCrops.java index e8d1cfbf..4788fb0b 100755 --- a/common/src/main/java/common/block/foliage/BlockCrops.java +++ b/common/src/main/java/common/block/foliage/BlockCrops.java @@ -12,7 +12,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.World; @@ -42,7 +42,7 @@ public class BlockCrops extends BlockBush implements IGrowable return ground == Blocks.farmland; } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { super.tick(worldIn, pos, state, rand); @@ -62,7 +62,7 @@ public class BlockCrops extends BlockBush implements IGrowable } } - public void grow(World worldIn, BlockPos pos, State state) + public void grow(World worldIn, LocalPos pos, State state) { int i = ((Integer)state.getValue(AGE)).intValue() + worldIn.rand.range(2, 5); @@ -74,10 +74,10 @@ public class BlockCrops extends BlockBush implements IGrowable worldIn.setState(pos, state.withProperty(AGE, Integer.valueOf(i)), 2); } - protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos) + protected static float getGrowthChance(Block blockIn, World worldIn, LocalPos pos) { float f = 1.0F; - BlockPos blockpos = pos.down(); + LocalPos blockpos = pos.down(); for (int i = -1; i <= 1; ++i) { @@ -105,10 +105,10 @@ public class BlockCrops extends BlockBush implements IGrowable } } - BlockPos blockpos1 = pos.north(); - BlockPos blockpos2 = pos.south(); - BlockPos blockpos3 = pos.west(); - BlockPos blockpos4 = pos.east(); + LocalPos blockpos1 = pos.north(); + LocalPos blockpos2 = pos.south(); + LocalPos blockpos3 = pos.west(); + LocalPos blockpos4 = pos.east(); boolean flag = blockIn == worldIn.getState(blockpos3).getBlock() || blockIn == worldIn.getState(blockpos4).getBlock(); boolean flag1 = blockIn == worldIn.getState(blockpos1).getBlock() || blockIn == worldIn.getState(blockpos2).getBlock(); @@ -129,7 +129,7 @@ public class BlockCrops extends BlockBush implements IGrowable return f; } - public boolean canBlockStay(World worldIn, BlockPos pos, State state) + public boolean canBlockStay(World worldIn, LocalPos pos, State state) { return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); } @@ -146,7 +146,7 @@ public class BlockCrops extends BlockBush implements IGrowable /** * Spawns this Block's drops into the World as EntityItems. */ - public void drop(World worldIn, BlockPos pos, State state, int fortune) + public void drop(World worldIn, LocalPos pos, State state, int fortune) { super.drop(worldIn, pos, state, fortune); @@ -180,17 +180,17 @@ public class BlockCrops extends BlockBush implements IGrowable /** * Whether this IGrowable can grow */ - public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient) + public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient) { return ((Integer)state.getValue(AGE)).intValue() < 7; } - public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) + public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state) { return true; } - public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) + public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state) { this.grow(worldIn, pos, state); } diff --git a/common/src/main/java/common/block/foliage/BlockDeadBush.java b/common/src/main/java/common/block/foliage/BlockDeadBush.java index 10b56077..73980ddc 100755 --- a/common/src/main/java/common/block/foliage/BlockDeadBush.java +++ b/common/src/main/java/common/block/foliage/BlockDeadBush.java @@ -14,7 +14,7 @@ import common.model.Model.ModelProvider; import common.model.GuiPosition; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Equipment; import common.world.State; import common.world.World; @@ -48,7 +48,7 @@ public class BlockDeadBush extends BlockBush /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean canReplace(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, LocalPos pos) { return true; } @@ -61,7 +61,7 @@ public class BlockDeadBush extends BlockBush return rand.chance(5) ? Items.stick : null; } - public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te) { if (!worldIn.client && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS) { diff --git a/common/src/main/java/common/block/foliage/BlockDoublePlant.java b/common/src/main/java/common/block/foliage/BlockDoublePlant.java index 30074086..48fa4532 100755 --- a/common/src/main/java/common/block/foliage/BlockDoublePlant.java +++ b/common/src/main/java/common/block/foliage/BlockDoublePlant.java @@ -18,7 +18,7 @@ import common.properties.Property; import common.properties.PropertyEnum; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Equipment; import common.util.Identifyable; import common.util.Facing.Axis; @@ -54,7 +54,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable return this.type; } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.plantDry && worldIn.getTemperatureC(pos) >= 50.0f) { @@ -72,12 +72,12 @@ public class BlockDoublePlant extends BlockBush implements IGrowable super.tick(worldIn, pos, state, rand); } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return super.canPlace(worldIn, pos) && worldIn.isAirBlock(pos.up()); } @@ -85,7 +85,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean canReplace(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos); @@ -99,13 +99,13 @@ public class BlockDoublePlant extends BlockBush implements IGrowable } } - protected void checkAndDropBlock(World worldIn, BlockPos pos, State state) + protected void checkAndDropBlock(World worldIn, LocalPos pos, State state) { if (!this.canBlockStay(worldIn, pos, state)) { boolean flag = state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER; - BlockPos blockpos = flag ? pos : pos.up(); - BlockPos blockpos1 = flag ? pos.down() : pos; + LocalPos blockpos = flag ? pos : pos.up(); + LocalPos blockpos1 = flag ? pos.down() : pos; Block block = (Block)(flag ? this : worldIn.getState(blockpos).getBlock()); Block block1 = (Block)(flag ? worldIn.getState(blockpos1).getBlock() : this); @@ -126,7 +126,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable } } - public boolean canBlockStay(World worldIn, BlockPos pos, State state) + public boolean canBlockStay(World worldIn, LocalPos pos, State state) { if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) { @@ -154,7 +154,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable } } - public void placeAt(World worldIn, BlockPos lowerPos, int flags) + public void placeAt(World worldIn, LocalPos lowerPos, int flags) { worldIn.setState(lowerPos, this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER), flags); worldIn.setState(lowerPos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags); @@ -163,12 +163,12 @@ public class BlockDoublePlant extends BlockBush implements IGrowable /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ - public void onPlace(World worldIn, BlockPos pos, State state, EntityLiving placer) + public void onPlace(World worldIn, LocalPos pos, State state, EntityLiving placer) { worldIn.setState(pos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), 2); } - public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te) { if (worldIn.client || player.getHeldItem() == null || !(player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS) || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) { @@ -176,7 +176,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable } } - public void preBroken(World worldIn, BlockPos pos, State state, EntityNPC player) + public void preBroken(World worldIn, LocalPos pos, State state, EntityNPC player) { if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) { @@ -221,7 +221,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable super.preBroken(worldIn, pos, state, player); } - private boolean onHarvest(World worldIn, BlockPos pos, State state, EntityNPC player) + private boolean onHarvest(World worldIn, LocalPos pos, State state, EntityNPC player) { if (this.type != BlockDoublePlant.EnumPlantType.FERN && this.type != BlockDoublePlant.EnumPlantType.GRASS) { @@ -237,17 +237,17 @@ public class BlockDoublePlant extends BlockBush implements IGrowable /** * Whether this IGrowable can grow */ - public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient) + public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient) { return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN; } - public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) + public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state) { return true; } - public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) + public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state) { dropItem(worldIn, pos, new ItemStack(this.getItem())); } diff --git a/common/src/main/java/common/block/foliage/BlockFarmland.java b/common/src/main/java/common/block/foliage/BlockFarmland.java index 301e3b13..84af883b 100755 --- a/common/src/main/java/common/block/foliage/BlockFarmland.java +++ b/common/src/main/java/common/block/foliage/BlockFarmland.java @@ -11,9 +11,10 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; +import common.util.MutablePos; import common.vars.Vars; import common.world.IWorldAccess; import common.world.State; @@ -33,7 +34,7 @@ public class BlockFarmland extends Block this.setOpacity(255); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return new BoundingBox((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)); } @@ -51,7 +52,7 @@ public class BlockFarmland extends Block return false; } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { int i = ((Integer)state.getValue(MOISTURE)).intValue(); @@ -77,7 +78,7 @@ public class BlockFarmland extends Block /** * Block's chance to react to a living entity falling on it. */ - public void onLandUpdate(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) + public void onLandUpdate(World worldIn, LocalPos pos, Entity entityIn, float fallDistance) { if (entityIn instanceof EntityLiving) { @@ -91,15 +92,15 @@ public class BlockFarmland extends Block } } - private boolean hasCrops(World worldIn, BlockPos pos) + private boolean hasCrops(World worldIn, LocalPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return block instanceof BlockCrops || block instanceof BlockStem; } - private boolean hasWater(World worldIn, BlockPos pos) + private boolean hasWater(World worldIn, LocalPos pos) { - for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(pos.add(-4, 0, -4), pos.add(4, 1, 4))) + for (MutablePos blockpos$mutableblockpos : MutablePos.mutableArea(pos.add(-4, 0, -4), pos.add(4, 1, 4))) { if (worldIn.getState(blockpos$mutableblockpos).getBlock().getMaterial() == Material.WATER) { @@ -113,7 +114,7 @@ public class BlockFarmland extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { super.onUpdate(worldIn, pos, state, neighborBlock); @@ -123,7 +124,7 @@ public class BlockFarmland extends Block } } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { switch (side) { diff --git a/common/src/main/java/common/block/foliage/BlockFlower.java b/common/src/main/java/common/block/foliage/BlockFlower.java index 0a7d6bf2..ba78fa0e 100755 --- a/common/src/main/java/common/block/foliage/BlockFlower.java +++ b/common/src/main/java/common/block/foliage/BlockFlower.java @@ -6,7 +6,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.model.GuiPosition; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Identifyable; import common.vars.Vars; import common.world.State; @@ -38,7 +38,7 @@ public class BlockFlower extends BlockBush return super.canPlaceBlockOn(ground) || ((this.type == EnumFlowerType.BLUE_ORCHID || this.type == EnumFlowerType.BLACK_LOTUS) && ground == Blocks.swamp); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.flowerDry && worldIn.getTemperatureC(pos) >= 50.0f) { diff --git a/common/src/main/java/common/block/foliage/BlockGrass.java b/common/src/main/java/common/block/foliage/BlockGrass.java index 619e12fe..3278890a 100755 --- a/common/src/main/java/common/block/foliage/BlockGrass.java +++ b/common/src/main/java/common/block/foliage/BlockGrass.java @@ -10,7 +10,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.IWorldAccess; import common.world.State; @@ -29,13 +29,13 @@ public class BlockGrass extends Block implements IGrowable this.setTab(CheatTab.NATURE); } - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (worldIn.getState(pos.up()).getBlock().getLightOpacity() > 2) { @@ -48,7 +48,7 @@ public class BlockGrass extends Block implements IGrowable { for (int i = 0; i < 4; ++i) { - BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1); + LocalPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1); Block block = worldIn.getState(blockpos.up()).getBlock(); State iblockstate = worldIn.getState(blockpos); @@ -71,17 +71,17 @@ public class BlockGrass extends Block implements IGrowable return Blocks.dirt.getDrop(Blocks.dirt.getState(), rand, fortune); } - public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient) + public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient) { return true; } - public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) + public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state) { return true; } - public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) + public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state) { worldIn.growGrass(pos, state, rand); } diff --git a/common/src/main/java/common/block/foliage/BlockLeaves.java b/common/src/main/java/common/block/foliage/BlockLeaves.java index 5914123f..920024bb 100755 --- a/common/src/main/java/common/block/foliage/BlockLeaves.java +++ b/common/src/main/java/common/block/foliage/BlockLeaves.java @@ -19,8 +19,9 @@ import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; +import common.util.MutablePos; import common.util.Equipment; import common.vars.Vars; import common.world.State; @@ -63,7 +64,7 @@ public class BlockLeaves extends BlockLeavesBase return this.subType; } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { int i = 1; int j = i + 1; @@ -71,7 +72,7 @@ public class BlockLeaves extends BlockLeavesBase int l = pos.getY(); int i1 = pos.getZ(); - if (worldIn.isAreaLoaded(new BlockPos(k - j, l - j, i1 - j), new BlockPos(k + j, l + j, i1 + j))) + if (worldIn.isAreaLoaded(new LocalPos(k - j, l - j, i1 - j), new LocalPos(k + j, l + j, i1 + j))) { for (int j1 = -i; j1 <= i; ++j1) { @@ -79,7 +80,7 @@ public class BlockLeaves extends BlockLeavesBase { for (int l1 = -i; l1 <= i; ++l1) { - BlockPos blockpos = pos.add(j1, k1, l1); + LocalPos blockpos = pos.add(j1, k1, l1); State iblockstate = worldIn.getState(blockpos); if (iblockstate.getBlock().getMaterial() == Material.LEAVES && !iblockstate.getValue(BUSH) && !iblockstate.getValue(DECAY)) @@ -92,7 +93,7 @@ public class BlockLeaves extends BlockLeavesBase } } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.seasonLeaves && this.subType != worldIn.getLeavesGen(pos)) { worldIn.setState(pos, getLeavesBlock(this.type, worldIn.getLeavesGen(pos)).getState().withProperty(DECAY, state.getValue(DECAY)).withProperty(BUSH, state.getValue(BUSH)), 2); @@ -120,9 +121,9 @@ public class BlockLeaves extends BlockLeavesBase this.surroundings = new int[j1 * j1 * j1]; } - if (worldIn.isAreaLoaded(new BlockPos(k - j, l - j, i1 - j), new BlockPos(k + j, l + j, i1 + j))) + if (worldIn.isAreaLoaded(new LocalPos(k - j, l - j, i1 - j), new LocalPos(k + j, l + j, i1 + j))) { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int i2 = -i; i2 <= i; ++i2) { @@ -211,7 +212,7 @@ public class BlockLeaves extends BlockLeavesBase // } } - private void destroy(World worldIn, BlockPos pos) + private void destroy(World worldIn, LocalPos pos) { this.drop(worldIn, pos, worldIn.getState(pos), 0); worldIn.setBlockToAir(pos); @@ -236,7 +237,7 @@ public class BlockLeaves extends BlockLeavesBase /** * Spawns this Block's drops into the World as EntityItems. */ - public void drop(World worldIn, BlockPos pos, State state, int fortune) + public void drop(World worldIn, LocalPos pos, State state, int fortune) { if (!worldIn.client) { @@ -279,7 +280,7 @@ public class BlockLeaves extends BlockLeavesBase return new Property[] {DECAY, BUSH}; } - public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { + public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te) { if(!worldIn.client && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS) { dropItem(worldIn, pos, new ItemStack(this.getItem())); } @@ -288,7 +289,7 @@ public class BlockLeaves extends BlockLeavesBase } } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(DECAY, false).withProperty(BUSH, true); } diff --git a/common/src/main/java/common/block/foliage/BlockLilyPad.java b/common/src/main/java/common/block/foliage/BlockLilyPad.java index a0dab4c7..8a0c3765 100755 --- a/common/src/main/java/common/block/foliage/BlockLilyPad.java +++ b/common/src/main/java/common/block/foliage/BlockLilyPad.java @@ -19,7 +19,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.model.GuiPosition; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.HitPosition; @@ -37,7 +37,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable this.setTab(CheatTab.PLANTS); } - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { if (collidingEntity == null || !(collidingEntity instanceof EntityBoat)) { @@ -45,7 +45,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable } } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return 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); } @@ -55,7 +55,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable return ground.getMaterial().isColdLiquid() && ground instanceof BlockStaticLiquid; } - public boolean canBlockStay(World worldIn, BlockPos pos, State state) + public boolean canBlockStay(World worldIn, LocalPos pos, State state) { if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { @@ -74,7 +74,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable return new Property[] {FACING}; } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } @@ -103,7 +103,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable { if (movingobjectposition.type == HitPosition.ObjectType.BLOCK) { - BlockPos blockpos = movingobjectposition.block; + LocalPos blockpos = movingobjectposition.block; if (!World.isValidXZ(blockpos)) { @@ -115,7 +115,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable return false; } - BlockPos blockpos1 = blockpos.up(); + LocalPos blockpos1 = blockpos.up(); State iblockstate = worldIn.getState(blockpos); if (iblockstate.getBlock().getMaterial().isColdLiquid() && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) diff --git a/common/src/main/java/common/block/foliage/BlockLog.java b/common/src/main/java/common/block/foliage/BlockLog.java index e4c840c6..b6ef95e6 100755 --- a/common/src/main/java/common/block/foliage/BlockLog.java +++ b/common/src/main/java/common/block/foliage/BlockLog.java @@ -9,7 +9,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -27,14 +27,14 @@ public class BlockLog extends BlockRotatedPillar this.setFlammable(5, 5); } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { int r = 4; int l = r + 1; if (worldIn.isAreaLoaded(pos.add(-l, -l, -l), pos.add(l, l, l))) { - for (BlockPos bpos : BlockPos.getAllInBox(pos.add(-r, -r, -r), pos.add(r, r, r))) + for (LocalPos bpos : LocalPos.area(pos.add(-r, -r, -r), pos.add(r, r, r))) { State blk = worldIn.getState(bpos); @@ -46,7 +46,7 @@ public class BlockLog extends BlockRotatedPillar } } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(AXIS, facing.getAxis()); } diff --git a/common/src/main/java/common/block/foliage/BlockMushroom.java b/common/src/main/java/common/block/foliage/BlockMushroom.java index 5940671f..470e2bfc 100755 --- a/common/src/main/java/common/block/foliage/BlockMushroom.java +++ b/common/src/main/java/common/block/foliage/BlockMushroom.java @@ -6,7 +6,8 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.model.GuiPosition; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; +import common.util.MutablePos; import common.vars.Vars; import common.world.State; import common.world.World; @@ -21,14 +22,14 @@ public class BlockMushroom extends BlockBush implements IGrowable this.setTicked(); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (Vars.shroomGrowth > 0 && rand.chance(Vars.shroomGrowth)) { int i = 5; int j = 4; - for (BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add(-4, -1, -4), pos.add(4, 1, 4))) + for (LocalPos blockpos : MutablePos.mutableArea(pos.add(-4, -1, -4), pos.add(4, 1, 4))) { if (worldIn.getState(blockpos).getBlock() == this) { @@ -41,7 +42,7 @@ public class BlockMushroom extends BlockBush implements IGrowable } } - BlockPos blockpos1 = pos.add(rand.zrange(3) - 1, rand.zrange(2) - rand.zrange(2), rand.zrange(3) - 1); + LocalPos blockpos1 = pos.add(rand.zrange(3) - 1, rand.zrange(2) - rand.zrange(2), rand.zrange(3) - 1); for (int k = 0; k < 4; ++k) { @@ -60,7 +61,7 @@ public class BlockMushroom extends BlockBush implements IGrowable } } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState()); } @@ -73,7 +74,7 @@ public class BlockMushroom extends BlockBush implements IGrowable return ground.isFullBlock(); } - public boolean canBlockStay(World worldIn, BlockPos pos, State state) + public boolean canBlockStay(World worldIn, LocalPos pos, State state) { if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { @@ -89,17 +90,17 @@ public class BlockMushroom extends BlockBush implements IGrowable /** * Whether this IGrowable can grow */ - public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient) + public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient) { return true; } - public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) + public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state) { return (double)rand.floatv() < 0.4D; } - public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) + public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state) { worldIn.generateBigMushroom(pos, state, rand); } diff --git a/common/src/main/java/common/block/foliage/BlockMycelium.java b/common/src/main/java/common/block/foliage/BlockMycelium.java index 8f3be81e..b573cb7b 100755 --- a/common/src/main/java/common/block/foliage/BlockMycelium.java +++ b/common/src/main/java/common/block/foliage/BlockMycelium.java @@ -10,7 +10,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ParticleType; import common.vars.Vars; import common.world.IWorldAccess; @@ -34,13 +34,13 @@ public class BlockMycelium extends Block * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { // if (!worldIn.client) // { @@ -53,7 +53,7 @@ public class BlockMycelium extends Block { for (int i = 0; i < 4; ++i) { - BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1); + LocalPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1); State iblockstate = worldIn.getState(blockpos); Block block = worldIn.getState(blockpos.up()).getBlock(); @@ -66,7 +66,7 @@ public class BlockMycelium extends Block // } } - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) + public void displayTick(World worldIn, LocalPos pos, State state, Random rand) { super.displayTick(worldIn, pos, state, rand); diff --git a/common/src/main/java/common/block/foliage/BlockPotato.java b/common/src/main/java/common/block/foliage/BlockPotato.java index 8d123406..5df51af4 100755 --- a/common/src/main/java/common/block/foliage/BlockPotato.java +++ b/common/src/main/java/common/block/foliage/BlockPotato.java @@ -5,7 +5,7 @@ import common.item.Item; import common.item.ItemStack; import common.model.Model; import common.model.Model.ModelProvider; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import common.world.World; @@ -23,7 +23,7 @@ public class BlockPotato extends BlockCrops /** * Spawns this Block's drops into the World as EntityItems. */ - public void drop(World worldIn, BlockPos pos, State state, int fortune) + public void drop(World worldIn, LocalPos pos, State state, int fortune) { super.drop(worldIn, pos, state, fortune); diff --git a/common/src/main/java/common/block/foliage/BlockPumpkin.java b/common/src/main/java/common/block/foliage/BlockPumpkin.java index 5508e4b9..203d5601 100755 --- a/common/src/main/java/common/block/foliage/BlockPumpkin.java +++ b/common/src/main/java/common/block/foliage/BlockPumpkin.java @@ -5,7 +5,7 @@ import common.block.Material; import common.item.CheatTab; import common.model.Model; import common.model.Model.ModelProvider; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import common.world.World; @@ -15,7 +15,7 @@ public class BlockPumpkin extends Block { this.setTab(CheatTab.PLANTS); } - public boolean canPlace(World world, BlockPos pos) { + public boolean canPlace(World world, LocalPos pos) { return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down()); } diff --git a/common/src/main/java/common/block/foliage/BlockReed.java b/common/src/main/java/common/block/foliage/BlockReed.java index abe1e285..6484fcd0 100755 --- a/common/src/main/java/common/block/foliage/BlockReed.java +++ b/common/src/main/java/common/block/foliage/BlockReed.java @@ -10,7 +10,7 @@ import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.vars.Vars; @@ -31,7 +31,7 @@ public class BlockReed extends Block this.setTicked(); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.reedDry && worldIn.getTemperatureC(pos) >= 50.0f) { @@ -67,7 +67,7 @@ public class BlockReed extends Block } } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { Block block = worldIn.getState(pos.down()).getBlock(); @@ -96,12 +96,12 @@ public class BlockReed extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { this.checkForDrop(worldIn, pos, state); } - protected final boolean checkForDrop(World worldIn, BlockPos pos, State state) + protected final boolean checkForDrop(World worldIn, LocalPos pos, State state) { if (this.canBlockStay(worldIn, pos)) { @@ -115,12 +115,12 @@ public class BlockReed extends Block } } - public boolean canBlockStay(World worldIn, BlockPos pos) + public boolean canBlockStay(World worldIn, LocalPos pos) { return this.canPlace(worldIn, pos); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } diff --git a/common/src/main/java/common/block/foliage/BlockSapling.java b/common/src/main/java/common/block/foliage/BlockSapling.java index 4b52e9f0..d375ea35 100755 --- a/common/src/main/java/common/block/foliage/BlockSapling.java +++ b/common/src/main/java/common/block/foliage/BlockSapling.java @@ -13,7 +13,7 @@ import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.World; @@ -51,7 +51,7 @@ public class BlockSapling extends BlockBush implements IGrowable // return I18n.translate(this.getUnlocalizedName() + "." + BlockPlanks.EnumType.OAK.getUnlocalizedName() + ".name"); // } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.saplingDry && worldIn.getTemperatureC(pos) >= 50.0f) { @@ -70,7 +70,7 @@ public class BlockSapling extends BlockBush implements IGrowable // } } - public void grow(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void grow(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (((Integer)state.getValue(STAGE)).intValue() == 0) { @@ -105,17 +105,17 @@ public class BlockSapling extends BlockBush implements IGrowable /** * Whether this IGrowable can grow */ - public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient) + public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient) { return true; } - public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) + public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state) { return (double)worldIn.rand.floatv() < 0.45D; } - public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) + public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state) { this.grow(worldIn, pos, state, rand); } diff --git a/common/src/main/java/common/block/foliage/BlockSoulGrass.java b/common/src/main/java/common/block/foliage/BlockSoulGrass.java index 727fa928..8de71cf7 100755 --- a/common/src/main/java/common/block/foliage/BlockSoulGrass.java +++ b/common/src/main/java/common/block/foliage/BlockSoulGrass.java @@ -11,7 +11,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.World; @@ -33,11 +33,11 @@ public class BlockSoulGrass extends BlockBush { return ground == Blocks.soul_sand; } - public boolean canBlockStay(World worldIn, BlockPos pos, State state) { + public boolean canBlockStay(World worldIn, LocalPos pos, State state) { return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.soulGrassGrowth > 0) { int i = ((Integer)state.getValue(AGE)).intValue(); @@ -50,7 +50,7 @@ public class BlockSoulGrass extends BlockBush { super.tick(worldIn, pos, state, rand); } - public void drop(World worldIn, BlockPos pos, State state, int fortune) { + public void drop(World worldIn, LocalPos pos, State state, int fortune) { if(!worldIn.client) { int i = 1; diff --git a/common/src/main/java/common/block/foliage/BlockStem.java b/common/src/main/java/common/block/foliage/BlockStem.java index af828bd5..ee513497 100755 --- a/common/src/main/java/common/block/foliage/BlockStem.java +++ b/common/src/main/java/common/block/foliage/BlockStem.java @@ -10,7 +10,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.vars.Vars; import common.world.IWorldAccess; @@ -42,7 +42,7 @@ public class BlockStem extends BlockBush implements IGrowable return ground == Blocks.farmland; } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { super.tick(worldIn, pos, state, rand); @@ -61,7 +61,7 @@ public class BlockStem extends BlockBush implements IGrowable } else { - BlockPos pos2 = pos.offset(Facing.Plane.HORIZONTAL.random(rand)); + LocalPos pos2 = pos.offset(Facing.Plane.HORIZONTAL.random(rand)); Block block = worldIn.getState(pos2.down()).getBlock(); Block block2 = worldIn.getState(pos2).getBlock(); @@ -78,13 +78,13 @@ public class BlockStem extends BlockBush implements IGrowable } } - public void growStem(World worldIn, BlockPos pos, State state) + public void growStem(World worldIn, LocalPos pos, State state) { int i = ((Integer)state.getValue(AGE)).intValue() + worldIn.rand.range(2, 5); worldIn.setState(pos, state.withProperty(AGE, Integer.valueOf(Math.min(7, i))), 2); } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { this.maxY = (double)((float)(((Integer)worldIn.getState(pos).getValue(AGE)).intValue() * 2 + 2) / 16.0F); float f = 0.125F; @@ -94,7 +94,7 @@ public class BlockStem extends BlockBush implements IGrowable /** * Spawns this Block's drops into the World as EntityItems. */ - public void drop(World worldIn, BlockPos pos, State state, int fortune) + public void drop(World worldIn, LocalPos pos, State state, int fortune) { super.drop(worldIn, pos, state, fortune); @@ -115,17 +115,17 @@ public class BlockStem extends BlockBush implements IGrowable /** * Whether this IGrowable can grow */ - public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient) + public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient) { return ((Integer)state.getValue(AGE)).intValue() != 7; } - public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) + public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state) { return true; } - public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) + public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state) { this.growStem(worldIn, pos, state); } diff --git a/common/src/main/java/common/block/foliage/BlockSwamp.java b/common/src/main/java/common/block/foliage/BlockSwamp.java index 4936086a..2c8fc71c 100644 --- a/common/src/main/java/common/block/foliage/BlockSwamp.java +++ b/common/src/main/java/common/block/foliage/BlockSwamp.java @@ -11,7 +11,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.vars.Vars; import common.world.AWorldServer; @@ -31,19 +31,19 @@ public class BlockSwamp extends Block this.setTab(CheatTab.NATURE); } - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { float f = 0.375F; return new BoundingBox((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)((float)(pos.getY() + 1) - f), (double)(pos.getZ() + 1)); } - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { entityIn.motionX *= 0.6D; entityIn.motionZ *= 0.6D; @@ -70,7 +70,7 @@ public class BlockSwamp extends Block return Blocks.dirt.getDrop(Blocks.dirt.getState(), rand, fortune); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (worldIn.getState(pos.up()).getBlock().getLightOpacity() > 2) { diff --git a/common/src/main/java/common/block/foliage/BlockTallGrass.java b/common/src/main/java/common/block/foliage/BlockTallGrass.java index 24906653..75d33603 100755 --- a/common/src/main/java/common/block/foliage/BlockTallGrass.java +++ b/common/src/main/java/common/block/foliage/BlockTallGrass.java @@ -13,7 +13,7 @@ import common.model.Model.ModelProvider; import common.model.GuiPosition; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Equipment; import common.util.Identifyable; import common.vars.Vars; @@ -45,7 +45,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable return this.type; } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.tallgrassDry && worldIn.getTemperatureC(pos) >= 50.0f && this.type != EnumType.DEAD_BUSH) { @@ -61,7 +61,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable return super.canPlaceBlockOn(ground) || (this.type == EnumType.SWAMP_GRASS && ground == Blocks.swamp); } - public boolean canBlockStay(World worldIn, BlockPos pos, State state) + public boolean canBlockStay(World worldIn, LocalPos pos, State state) { return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); } @@ -69,7 +69,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean canReplace(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, LocalPos pos) { return true; } @@ -90,7 +90,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable return random.roll(fortune * 2 + 1); } - public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te) { if (!worldIn.client && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS) { @@ -105,17 +105,17 @@ public class BlockTallGrass extends BlockBush implements IGrowable /** * Whether this IGrowable can grow */ - public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient) + public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient) { return this.type != EnumType.DEAD_BUSH; } - public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state) + public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state) { return true; } - public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) + public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state) { BlockDoublePlant block = Blocks.large_tallgrass; diff --git a/common/src/main/java/common/block/foliage/BlockTianSoil.java b/common/src/main/java/common/block/foliage/BlockTianSoil.java index 86624e80..c0da9ca7 100755 --- a/common/src/main/java/common/block/foliage/BlockTianSoil.java +++ b/common/src/main/java/common/block/foliage/BlockTianSoil.java @@ -10,7 +10,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.IWorldAccess; import common.world.State; @@ -25,7 +25,7 @@ public class BlockTianSoil extends Block this.setTab(CheatTab.NATURE); } - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); diff --git a/common/src/main/java/common/block/foliage/BlockVine.java b/common/src/main/java/common/block/foliage/BlockVine.java index 82580218..90143589 100755 --- a/common/src/main/java/common/block/foliage/BlockVine.java +++ b/common/src/main/java/common/block/foliage/BlockVine.java @@ -17,7 +17,7 @@ import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.Equipment; @@ -52,7 +52,7 @@ public class BlockVine extends Block * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock().isBlockingCube())); } @@ -73,12 +73,12 @@ public class BlockVine extends Block /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean canReplace(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, LocalPos pos) { return true; } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { float f = 0.0625F; float f1 = 1.0F; @@ -146,7 +146,7 @@ public class BlockVine extends Block this.setBlockBounds(f1, f2, f3, f4, f5, f6); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -154,7 +154,7 @@ public class BlockVine extends Block /** * Check whether this Block can be placed on the given side */ - public boolean canPlace(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, LocalPos pos, Facing side) { switch (side) { @@ -177,7 +177,7 @@ public class BlockVine extends Block return blockIn.isFullCube() && blockIn.getMaterial().blocksMovement(); } - private boolean recheckGrownSides(World worldIn, BlockPos pos, State state) + private boolean recheckGrownSides(World worldIn, LocalPos pos, State state) { State iblockstate = state; @@ -214,7 +214,7 @@ public class BlockVine extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!worldIn.client && !this.recheckGrownSides(worldIn, pos, state)) { @@ -223,7 +223,7 @@ public class BlockVine extends Block } } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.vineDry && worldIn.getTemperatureC(pos) >= 50.0f) { @@ -260,7 +260,7 @@ public class BlockVine extends Block } Facing enumfacing1 = Facing.random(rand); - BlockPos blockpos1 = pos.up(); + LocalPos blockpos1 = pos.up(); if (enumfacing1 == Facing.UP && pos.getY() < World.MAX_SIZE_Y - 1 && worldIn.isAirBlock(blockpos1)) { @@ -286,7 +286,7 @@ public class BlockVine extends Block { if (!flag) { - BlockPos blockpos3 = pos.offset(enumfacing1); + LocalPos blockpos3 = pos.offset(enumfacing1); Block block1 = worldIn.getState(blockpos3).getBlock(); if (block1 == Blocks.air) @@ -295,8 +295,8 @@ public class BlockVine extends Block Facing enumfacing4 = enumfacing1.rotateYCCW(); boolean flag1 = ((Boolean)state.getValue(getPropertyFor(enumfacing2))).booleanValue(); boolean flag2 = ((Boolean)state.getValue(getPropertyFor(enumfacing4))).booleanValue(); - BlockPos blockpos4 = blockpos3.offset(enumfacing2); - BlockPos blockpos = blockpos3.offset(enumfacing4); + LocalPos blockpos4 = blockpos3.offset(enumfacing2); + LocalPos blockpos = blockpos3.offset(enumfacing4); if (flag1 && this.canPlaceOn(worldIn.getState(blockpos4).getBlock())) { @@ -329,7 +329,7 @@ public class BlockVine extends Block { if (pos.getY() > 1) { - BlockPos blockpos2 = pos.down(); + LocalPos blockpos2 = pos.down(); State iblockstate = worldIn.getState(blockpos2); Block block = iblockstate.getBlock(); @@ -379,7 +379,7 @@ public class BlockVine extends Block * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = this.getState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)); return facing.getAxis().isHorizontal() ? iblockstate.withProperty(getPropertyFor(facing.getOpposite()), Boolean.valueOf(true)) : iblockstate; @@ -401,7 +401,7 @@ public class BlockVine extends Block return 0; } - public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te) { if (!worldIn.client && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS) { diff --git a/common/src/main/java/common/block/foliage/IGrowable.java b/common/src/main/java/common/block/foliage/IGrowable.java index 87ca9b80..a7e7d9a7 100755 --- a/common/src/main/java/common/block/foliage/IGrowable.java +++ b/common/src/main/java/common/block/foliage/IGrowable.java @@ -1,16 +1,16 @@ package common.block.foliage; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import common.world.World; import common.world.AWorldServer; public interface IGrowable { - boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient); + boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient); - boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state); + boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state); - void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state); + void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state); } diff --git a/common/src/main/java/common/block/liquid/BlockDynamicLiquid.java b/common/src/main/java/common/block/liquid/BlockDynamicLiquid.java index 5f609279..912db063 100755 --- a/common/src/main/java/common/block/liquid/BlockDynamicLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockDynamicLiquid.java @@ -10,7 +10,7 @@ import common.block.artificial.BlockDoor; import common.init.BlockRegistry; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.vars.Vars; import common.world.State; @@ -35,12 +35,12 @@ public class BlockDynamicLiquid extends BlockLiquid return this.staticBlock; } - private void placeStaticBlock(World worldIn, BlockPos pos, State currentState) + private void placeStaticBlock(World worldIn, LocalPos pos, State currentState) { worldIn.setState(pos, this.staticBlock.getState().withProperty(LEVEL, currentState.getValue(LEVEL)), 2); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(this.material == Material.WATER && !worldIn.getState(pos.up()).getBlock().isOpaqueCube() && worldIn.canBlockFreeze(pos, true) && rand.chance(25)) { worldIn.setState(pos, Blocks.ice.getState()); @@ -179,7 +179,7 @@ public class BlockDynamicLiquid extends BlockLiquid } } - private void tryFlowInto(World worldIn, BlockPos pos, State state, int level) + private void tryFlowInto(World worldIn, LocalPos pos, State state, int level) { if (this.canFlowInto(worldIn, pos, state)) { @@ -199,7 +199,7 @@ public class BlockDynamicLiquid extends BlockLiquid } } - private int propogateLiquid(World worldIn, BlockPos pos, int distance, Facing calculateFlowCost) + private int propogateLiquid(World worldIn, LocalPos pos, int distance, Facing calculateFlowCost) { int i = 1000; @@ -207,7 +207,7 @@ public class BlockDynamicLiquid extends BlockLiquid { if (enumfacing != calculateFlowCost) { - BlockPos blockpos = pos.offset(enumfacing); + LocalPos blockpos = pos.offset(enumfacing); State iblockstate = worldIn.getState(blockpos); if (!this.isBlocked(worldIn, blockpos, iblockstate) && (iblockstate.getBlock().getMaterial() != this.material || ((Integer)iblockstate.getValue(LEVEL)).intValue() > 0)) @@ -233,14 +233,14 @@ public class BlockDynamicLiquid extends BlockLiquid return i; } - private Set getPossibleFlowDirections(World worldIn, BlockPos pos) + private Set getPossibleFlowDirections(World worldIn, LocalPos pos) { int i = 1000; Set set = EnumSet.noneOf(Facing.class); for (Facing enumfacing : Facing.Plane.HORIZONTAL) { - BlockPos blockpos = pos.offset(enumfacing); + LocalPos blockpos = pos.offset(enumfacing); State iblockstate = worldIn.getState(blockpos); if (!this.isBlocked(worldIn, blockpos, iblockstate) && (iblockstate.getBlock().getMaterial() != this.material || ((Integer)iblockstate.getValue(LEVEL)).intValue() > 0)) @@ -272,13 +272,13 @@ public class BlockDynamicLiquid extends BlockLiquid return set; } - private boolean isBlocked(World worldIn, BlockPos pos, State state) + private boolean isBlocked(World worldIn, LocalPos pos, State state) { Block block = worldIn.getState(pos).getBlock(); return !(block instanceof BlockDoor) && block != Blocks.sign && block != Blocks.ladder && block != Blocks.reeds ? (block.getMaterial() == Material.PORTAL ? true : block.getMaterial().blocksMovement()) : true; } - protected int checkAdjacentBlock(World worldIn, BlockPos pos, int currentMinLevel) + protected int checkAdjacentBlock(World worldIn, LocalPos pos, int currentMinLevel) { int i = this.getLevel(worldIn, pos); @@ -302,13 +302,13 @@ public class BlockDynamicLiquid extends BlockLiquid } } - private boolean canFlowInto(World worldIn, BlockPos pos, State state) + private boolean canFlowInto(World worldIn, LocalPos pos, State state) { Material material = state.getBlock().getMaterial(); return (this.material == Material.LAVA || !(state.getBlock() instanceof BlockLiquid) || (state.getBlock() instanceof BlockStaticLiquid ? ((BlockStaticLiquid)state.getBlock()).getFlowingBlock() : state.getBlock()) == this) && material != this.material && material != Material.LAVA && !this.isBlocked(worldIn, pos, state); } - public void onAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, LocalPos pos, State state) { if (!this.checkForMixing(worldIn, pos, state)) { diff --git a/common/src/main/java/common/block/liquid/BlockLiquid.java b/common/src/main/java/common/block/liquid/BlockLiquid.java index d7222d24..3decc841 100755 --- a/common/src/main/java/common/block/liquid/BlockLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockLiquid.java @@ -12,9 +12,8 @@ import common.item.Item; import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; -import common.util.Clientside; import common.util.ExtMath; import common.util.Facing; import common.util.Pair; @@ -50,7 +49,7 @@ public abstract class BlockLiquid extends Block return this.animation; } - public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + public boolean isPassable(IBlockAccess worldIn, LocalPos pos) { return !this.material.isHotLiquid(); } @@ -68,12 +67,12 @@ public abstract class BlockLiquid extends Block return (float)(meta + 1) / 9.0F; } - protected int getLevel(IBlockAccess worldIn, BlockPos pos) + protected int getLevel(IBlockAccess worldIn, LocalPos pos) { return worldIn.getState(pos).getBlock().getMaterial() == this.material ? ((Integer)worldIn.getState(pos).getValue(LEVEL)).intValue() : -1; } - protected int getEffectiveFlowDecay(IBlockAccess worldIn, BlockPos pos) + protected int getEffectiveFlowDecay(IBlockAccess worldIn, LocalPos pos) { int i = this.getLevel(worldIn, pos); return i >= 8 ? 0 : i; @@ -97,20 +96,20 @@ public abstract class BlockLiquid extends Block return liquid && ((Integer)state.getValue(LEVEL)).intValue() == 0; } - public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, Facing side) + public boolean isBlockSolid(IBlockAccess worldIn, LocalPos pos, Facing side) { Block block = worldIn.getState(pos).getBlock(); return block.getMaterial() == this.material ? false : (side == Facing.UP ? true : (block != Blocks.ice && worldIn.getState(pos).getBlock().getMaterial().isSolid())); } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { Block block = worldIn.getState(pos).getBlock(); Material material = block.getMaterial(); return material.isLiquid() && (material.isColdLiquid() == this.material.isColdLiquid()) ? false : (side == Facing.UP ? true : !block.isNonBlock() && super.canRender(worldIn, pos, side)); } - public boolean shouldRenderSides(IBlockAccess blockAccess, BlockPos pos) + public boolean shouldRenderSides(IBlockAccess blockAccess, LocalPos pos) { for (int i = -1; i <= 1; ++i) { @@ -130,7 +129,7 @@ public abstract class BlockLiquid extends Block return false; } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -151,14 +150,14 @@ public abstract class BlockLiquid extends Block return 0; } - protected Vec3 getFlowVector(IBlockAccess worldIn, BlockPos pos) + protected Vec3 getFlowVector(IBlockAccess worldIn, LocalPos pos) { Vec3 vec3 = new Vec3(0.0D, 0.0D, 0.0D); int i = this.getEffectiveFlowDecay(worldIn, pos); for (Facing enumfacing : Facing.Plane.HORIZONTAL) { - BlockPos blockpos = pos.offset(enumfacing); + LocalPos blockpos = pos.offset(enumfacing); int j = this.getEffectiveFlowDecay(worldIn, blockpos); if (j < 0) @@ -170,14 +169,14 @@ public abstract class BlockLiquid extends Block if (j >= 0) { int k = j - (i - 8); - vec3 = vec3.addVector((double)((blockpos.getX() - pos.getX()) * k), (double)((blockpos.getY() - pos.getY()) * k), (double)((blockpos.getZ() - pos.getZ()) * k)); + vec3 = vec3.add((double)((blockpos.getX() - pos.getX()) * k), (double)((blockpos.getY() - pos.getY()) * k), (double)((blockpos.getZ() - pos.getZ()) * k)); } } } else if (j >= 0) { int l = j - i; - vec3 = vec3.addVector((double)((blockpos.getX() - pos.getX()) * l), (double)((blockpos.getY() - pos.getY()) * l), (double)((blockpos.getZ() - pos.getZ()) * l)); + vec3 = vec3.add((double)((blockpos.getX() - pos.getX()) * l), (double)((blockpos.getY() - pos.getY()) * l), (double)((blockpos.getZ() - pos.getZ()) * l)); } } @@ -185,11 +184,11 @@ public abstract class BlockLiquid extends Block { for (Facing enumfacing1 : Facing.Plane.HORIZONTAL) { - BlockPos blockpos1 = pos.offset(enumfacing1); + LocalPos blockpos1 = pos.offset(enumfacing1); if (this.isBlockSolid(worldIn, blockpos1, enumfacing1) || this.isBlockSolid(worldIn, blockpos1.up(), enumfacing1)) { - vec3 = vec3.normalize().addVector(0.0D, -6.0D, 0.0D); + vec3 = vec3.normalize().add(0.0D, -6.0D, 0.0D); break; } } @@ -198,7 +197,7 @@ public abstract class BlockLiquid extends Block return vec3.normalize(); } - public Vec3 getAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) + public Vec3 getAcceleration(World worldIn, LocalPos pos, Entity entityIn, Vec3 motion) { return motion.add(this.getFlowVector(worldIn, pos)); } @@ -206,12 +205,12 @@ public abstract class BlockLiquid extends Block /** * How many world ticks before ticking */ - public int tickRate(World worldIn, BlockPos pos) + public int tickRate(World worldIn, LocalPos pos) { return this.flowRate >= 0 ? this.flowRate : (worldIn.isLavaFaster(pos) ? (-this.flowRate / 3) : (-this.flowRate)); } - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) + public void displayTick(World worldIn, LocalPos pos, State state, Random rand) { double d0 = (double)pos.getX(); double d1 = (double)pos.getY(); @@ -248,13 +247,13 @@ public abstract class BlockLiquid extends Block } } - public static double getFlowDirection(IBlockAccess worldIn, BlockPos pos, BlockLiquid block) + public static double getFlowDirection(IBlockAccess worldIn, LocalPos pos, BlockLiquid block) { Vec3 vec3 = (block instanceof BlockStaticLiquid ? ((BlockStaticLiquid)block).getFlowingBlock() : block).getFlowVector(worldIn, pos); - return vec3.xCoord == 0.0D && vec3.zCoord == 0.0D ? -1000.0D : ExtMath.atan2(vec3.zCoord, vec3.xCoord) - (Math.PI / 2D); + return vec3.x == 0.0D && vec3.z == 0.0D ? -1000.0D : ExtMath.atan2(vec3.z, vec3.x) - (Math.PI / 2D); } - public void onAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, LocalPos pos, State state) { this.checkForMixing(worldIn, pos, state); } @@ -262,12 +261,12 @@ public abstract class BlockLiquid extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { this.checkForMixing(worldIn, pos, state); } - public boolean checkForMixing(World worldIn, BlockPos pos, State state) + public boolean checkForMixing(World worldIn, LocalPos pos, State state) { if(worldIn.client || !Vars.liquidPhysics) return true; @@ -307,7 +306,7 @@ public abstract class BlockLiquid extends Block return false; } - protected void triggerMixEffects(World worldIn, BlockPos pos) + protected void triggerMixEffects(World worldIn, LocalPos pos) { double d0 = (double)pos.getX(); double d1 = (double)pos.getY(); diff --git a/common/src/main/java/common/block/liquid/BlockStaticLiquid.java b/common/src/main/java/common/block/liquid/BlockStaticLiquid.java index 31c3284a..5446c100 100755 --- a/common/src/main/java/common/block/liquid/BlockStaticLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockStaticLiquid.java @@ -7,7 +7,7 @@ import common.block.Material; import common.init.BlockRegistry; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Pair; import common.vars.Vars; @@ -34,7 +34,7 @@ public class BlockStaticLiquid extends BlockLiquid /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!this.checkForMixing(worldIn, pos, state)) { @@ -42,13 +42,13 @@ public class BlockStaticLiquid extends BlockLiquid } } - private void updateLiquid(AWorldServer worldIn, BlockPos pos, State state) + private void updateLiquid(AWorldServer worldIn, LocalPos pos, State state) { worldIn.setState(pos, this.dynamicBlock.getState().withProperty(LEVEL, state.getValue(LEVEL)), 2); worldIn.scheduleUpdate(pos, this.dynamicBlock, this.tickRate(worldIn, pos)); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (Vars.lavaFire && this.material == Material.LAVA) { @@ -58,7 +58,7 @@ public class BlockStaticLiquid extends BlockLiquid if (i > 0) { - BlockPos blockpos = pos; + LocalPos blockpos = pos; for (int j = 0; j < i; ++j) { @@ -83,7 +83,7 @@ public class BlockStaticLiquid extends BlockLiquid { for (int k = 0; k < 3; ++k) { - BlockPos blockpos1 = pos.add(rand.zrange(3) - 1, 0, rand.zrange(3) - 1); + LocalPos blockpos1 = pos.add(rand.zrange(3) - 1, 0, rand.zrange(3) - 1); if (worldIn.isAirBlock(blockpos1.up()) && this.getCanBlockBurn(worldIn, blockpos1)) { @@ -97,7 +97,7 @@ public class BlockStaticLiquid extends BlockLiquid worldIn.setState(pos, Blocks.ice.getState()); } - protected boolean isSurroundingBlockFlammable(World worldIn, BlockPos pos) + protected boolean isSurroundingBlockFlammable(World worldIn, LocalPos pos) { for (Facing enumfacing : Facing.values()) { @@ -110,7 +110,7 @@ public class BlockStaticLiquid extends BlockLiquid return false; } - private boolean getCanBlockBurn(World worldIn, BlockPos pos) + private boolean getCanBlockBurn(World worldIn, LocalPos pos) { return worldIn.getState(pos).getBlock().getMaterial().getCanBurn(); } diff --git a/common/src/main/java/common/block/natural/BlockBedrock.java b/common/src/main/java/common/block/natural/BlockBedrock.java index 86d2b9f9..d1da9eda 100755 --- a/common/src/main/java/common/block/natural/BlockBedrock.java +++ b/common/src/main/java/common/block/natural/BlockBedrock.java @@ -3,7 +3,7 @@ package common.block.natural; import common.block.Block; import common.block.Material; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ParticleType; import common.world.State; import common.world.World; @@ -13,7 +13,7 @@ public class BlockBedrock extends Block { super(Material.SOLID); } - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) + public void displayTick(World worldIn, LocalPos pos, State state, Random rand) { if(/* worldIn.canShowVoidParticles() && */ pos.getY() <= 5 && rand.chance(8)) { worldIn.clientParticle(ParticleType.DEPTH, (double)pos.getX() + rand.floatv(), (double)(pos.getY()+1) + (rand.floatv() * 0.5f), diff --git a/common/src/main/java/common/block/natural/BlockBlackenedDirt.java b/common/src/main/java/common/block/natural/BlockBlackenedDirt.java index b4d370aa..d9c1615e 100644 --- a/common/src/main/java/common/block/natural/BlockBlackenedDirt.java +++ b/common/src/main/java/common/block/natural/BlockBlackenedDirt.java @@ -5,7 +5,7 @@ import common.block.Material; import common.init.Blocks; import common.item.CheatTab; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.AWorldServer; @@ -19,13 +19,13 @@ public class BlockBlackenedDirt extends Block this.setTab(CheatTab.NATURE); } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (Vars.darkDirtSpread) { for (int i = 0; i < 4; i++) { - BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1); + LocalPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1); Block block = worldIn.getState(blockpos.up()).getBlock(); State iblockstate = worldIn.getState(blockpos); diff --git a/common/src/main/java/common/block/natural/BlockCompressable.java b/common/src/main/java/common/block/natural/BlockCompressable.java index 7fdb64d5..5235dfc0 100644 --- a/common/src/main/java/common/block/natural/BlockCompressable.java +++ b/common/src/main/java/common/block/natural/BlockCompressable.java @@ -7,7 +7,7 @@ import common.block.Material; import common.block.SoundType; import common.entity.npc.EntityNPC; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.Color; import common.world.State; @@ -44,7 +44,7 @@ public class BlockCompressable extends Block { } @Clientside - public String getInfo(World world, BlockPos pos, State state, EntityNPC player) { + public String getInfo(World world, LocalPos pos, State state, EntityNPC player) { return this.compLevel > 0 ? Color.YELLOW + "" + this.compLevel + "-Fach komprimiert (x" + this.density + ")" : null; } } diff --git a/common/src/main/java/common/block/natural/BlockFire.java b/common/src/main/java/common/block/natural/BlockFire.java index 5094cd57..f98f7073 100755 --- a/common/src/main/java/common/block/natural/BlockFire.java +++ b/common/src/main/java/common/block/natural/BlockFire.java @@ -14,7 +14,7 @@ import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.ParticleType; @@ -41,7 +41,7 @@ public class BlockFire extends Block * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { int i = pos.getX(); int j = pos.getY(); @@ -73,7 +73,7 @@ public class BlockFire extends Block this.setTicked(); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -102,12 +102,12 @@ public class BlockFire extends Block /** * How many world ticks before ticking */ - public int tickRate(World worldIn, BlockPos pos) + public int tickRate(World worldIn, LocalPos pos) { return 30; } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (Vars.fire) { @@ -192,7 +192,7 @@ public class BlockFire extends Block i1 -= 1; } - BlockPos blockpos = pos.add(rand.chance(k, k * 2, 5), i1, rand.chance(l, l * 2, 5)); + LocalPos blockpos = pos.add(rand.chance(k, k * 2, 5), i1, rand.chance(l, l * 2, 5)); int k1 = this.getNeighborEncouragement(worldIn, blockpos); if (k1 > 0) @@ -224,7 +224,7 @@ public class BlockFire extends Block } } - protected boolean canDie(World world, BlockPos pos) + protected boolean canDie(World world, LocalPos pos) { return world.isRaining() && (world.isRainingAt(pos, true) || world.isRainingAt(pos.west(), true) || world.isRainingAt(pos.east(), true) || world.isRainingAt(pos.north(), true) || world.isRainingAt(pos.south(), true)); } @@ -234,7 +234,7 @@ public class BlockFire extends Block return false; } - protected void catchOnFire(World world, BlockPos pos, int chance, Random rand, int age) + protected void catchOnFire(World world, LocalPos pos, int chance, Random rand, int age) { int i = world.getState(pos).getBlock().getFlammability(); @@ -266,7 +266,7 @@ public class BlockFire extends Block } } - private boolean canNeighborCatchFire(World worldIn, BlockPos pos) + private boolean canNeighborCatchFire(World worldIn, LocalPos pos) { for (Facing enumfacing : Facing.values()) { @@ -279,7 +279,7 @@ public class BlockFire extends Block return false; } - private int getNeighborEncouragement(World worldIn, BlockPos pos) + private int getNeighborEncouragement(World worldIn, LocalPos pos) { if (!worldIn.isAirBlock(pos)) { @@ -305,12 +305,12 @@ public class BlockFire extends Block /** * Checks if the block can be caught on fire */ - public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos) + public boolean canCatchFire(IBlockAccess worldIn, LocalPos pos) { return worldIn.getState(pos).getBlock().getEncouragement() > 0; } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return worldIn.isBlockSolid(pos.down()) || this.canNeighborCatchFire(worldIn, pos); } @@ -318,7 +318,7 @@ public class BlockFire extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!worldIn.isBlockSolid(pos.down()) && !this.canNeighborCatchFire(worldIn, pos)) { @@ -326,7 +326,7 @@ public class BlockFire extends Block } } - public void onAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, LocalPos pos, State state) { if ( // (worldIn.dimension.getDimensionId() < -1 || worldIn.dimension.getDimensionId() > 0) || !BlockPortal.getByType(PortalType.values()[worldIn.rand.zrange(PortalType.values().length - 2)]).tryIgnitePortal(worldIn, pos)) @@ -342,7 +342,7 @@ public class BlockFire extends Block } } - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) + public void displayTick(World worldIn, LocalPos pos, State state, Random rand) { if (rand.chance(24)) { diff --git a/common/src/main/java/common/block/natural/BlockGlowstone.java b/common/src/main/java/common/block/natural/BlockGlowstone.java index ca1677d1..abf03d2d 100755 --- a/common/src/main/java/common/block/natural/BlockGlowstone.java +++ b/common/src/main/java/common/block/natural/BlockGlowstone.java @@ -7,7 +7,7 @@ import common.init.Items; import common.item.CheatTab; import common.item.Item; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Serverside; import common.world.AWorldServer; @@ -46,7 +46,7 @@ public class BlockGlowstone extends Block } @Serverside - public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) { + public boolean onShot(AWorldServer world, LocalPos pos, State state, Entity projectile) { world.destroyBlock(pos, true); return false; } diff --git a/common/src/main/java/common/block/natural/BlockIce.java b/common/src/main/java/common/block/natural/BlockIce.java index 2cab9139..539d1df7 100755 --- a/common/src/main/java/common/block/natural/BlockIce.java +++ b/common/src/main/java/common/block/natural/BlockIce.java @@ -8,7 +8,7 @@ import common.init.Blocks; import common.item.CheatTab; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.vars.Vars; import common.world.State; @@ -24,13 +24,13 @@ public class BlockIce extends Block { this.setTab(CheatTab.NATURE); } - public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) { + public boolean canRender(IWorldAccess world, LocalPos pos, Facing side) { State state = world.getState(pos); Block block = state.getBlock(); return block != this && super.canRender(world, pos, side); } - public void postBroken(World world, EntityNPC player, BlockPos pos, State state, TileEntity tile) { + public void postBroken(World world, EntityNPC player, LocalPos pos, State state, TileEntity tile) { if(this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) { super.postBroken(world, player, pos, state, tile); } @@ -50,7 +50,7 @@ public class BlockIce extends Block { return 0; } - public void tick(AWorldServer world, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer world, LocalPos pos, State state, Random rand) { if(Vars.iceMelt && !world.canFreezeAt(pos)) { if(world.doesWaterVaporize(pos)) { world.setBlockToAir(pos); diff --git a/common/src/main/java/common/block/natural/BlockOre.java b/common/src/main/java/common/block/natural/BlockOre.java index 1eca4564..09af070f 100755 --- a/common/src/main/java/common/block/natural/BlockOre.java +++ b/common/src/main/java/common/block/natural/BlockOre.java @@ -6,7 +6,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.World; @@ -83,7 +83,7 @@ public class BlockOre extends Block } } - public void drop(World worldIn, BlockPos pos, State state, int fortune) + public void drop(World worldIn, LocalPos pos, State state, int fortune) { if(!worldIn.client && this.smeltItem != null && Vars.cleanCut) { dropItem(worldIn, pos, this.smeltItem.copy()); diff --git a/common/src/main/java/common/block/natural/BlockPodzol.java b/common/src/main/java/common/block/natural/BlockPodzol.java index 168a0633..ddef4ab5 100644 --- a/common/src/main/java/common/block/natural/BlockPodzol.java +++ b/common/src/main/java/common/block/natural/BlockPodzol.java @@ -11,7 +11,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.IWorldAccess; import common.world.State; @@ -24,7 +24,7 @@ public class BlockPodzol extends Block { this.setTab(CheatTab.NATURE); } - public State getState(State state, IWorldAccess worldIn, BlockPos pos) { + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); } diff --git a/common/src/main/java/common/block/natural/BlockSlime.java b/common/src/main/java/common/block/natural/BlockSlime.java index 4a8bb267..d0bdca94 100755 --- a/common/src/main/java/common/block/natural/BlockSlime.java +++ b/common/src/main/java/common/block/natural/BlockSlime.java @@ -4,7 +4,7 @@ import common.block.Block; import common.block.Material; import common.entity.Entity; import common.item.CheatTab; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class BlockSlime extends Block { @@ -14,7 +14,7 @@ public class BlockSlime extends Block { this.setSlipperiness(0.8F); } - public void onLandUpdate(World world, BlockPos pos, Entity entity, float distance) { + public void onLandUpdate(World world, LocalPos pos, Entity entity, float distance) { if(entity.isSneaking()) super.onLandUpdate(world, pos, entity, distance); else @@ -28,7 +28,7 @@ public class BlockSlime extends Block { entity.motionY = -entity.motionY; } - public void onCollideMove(World world, BlockPos pos, Entity entity) { + public void onCollideMove(World world, LocalPos pos, Entity entity) { if(Math.abs(entity.motionY) < 0.1D && !entity.isSneaking()) { double friction = 0.4D + Math.abs(entity.motionY) * 0.2D; entity.motionX *= friction; diff --git a/common/src/main/java/common/block/natural/BlockSnow.java b/common/src/main/java/common/block/natural/BlockSnow.java index 0cddfaea..bb827d86 100755 --- a/common/src/main/java/common/block/natural/BlockSnow.java +++ b/common/src/main/java/common/block/natural/BlockSnow.java @@ -14,7 +14,7 @@ import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.vars.Vars; @@ -38,12 +38,12 @@ public class BlockSnow extends Block this.getBoundsForLayers(0); } - public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + public boolean isPassable(IBlockAccess worldIn, LocalPos pos) { return ((Integer)worldIn.getState(pos).getValue(LAYERS)).intValue() < 5; } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { int i = ((Integer)state.getValue(LAYERS)).intValue() - 1; if(i == 0) @@ -65,7 +65,7 @@ public class BlockSnow extends Block return false; } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos); this.getBoundsForLayers(((Integer)iblockstate.getValue(LAYERS)).intValue()); @@ -76,7 +76,7 @@ public class BlockSnow extends Block this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, (float)p_150154_1_ / 8.0F, 1.0F); } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos.down()); Block block = iblockstate.getBlock(); @@ -86,12 +86,12 @@ public class BlockSnow extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { this.checkAndDropBlock(worldIn, pos, state); } - private boolean checkAndDropBlock(World worldIn, BlockPos pos, State state) + private boolean checkAndDropBlock(World worldIn, LocalPos pos, State state) { if (!this.canPlace(worldIn, pos)) { @@ -105,7 +105,7 @@ public class BlockSnow extends Block } } - public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te) { dropItem(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1)); worldIn.setBlockToAir(pos); @@ -128,7 +128,7 @@ public class BlockSnow extends Block return 0; } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if (Vars.snowMelt && !worldIn.canFreezeAt(pos)) { @@ -137,7 +137,7 @@ public class BlockSnow extends Block } } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return side == Facing.UP ? true : super.canRender(worldIn, pos, side); } @@ -145,7 +145,7 @@ public class BlockSnow extends Block /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean canReplace(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, LocalPos pos) { return ((Integer)worldIn.getState(pos).getValue(LAYERS)).intValue() == 1; } @@ -161,7 +161,7 @@ public class BlockSnow extends Block provider.getModel("snow").add(0, 0, 0, 16, height, 16).u().noCull().d().nswe().uv(0, 16 - height, 16, 16); } - public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (stack.isEmpty()) { @@ -175,7 +175,7 @@ public class BlockSnow extends Block { State iblockstate = worldIn.getState(pos); Block block = iblockstate.getBlock(); - BlockPos blockpos = pos; + LocalPos blockpos = pos; if ((side != Facing.UP || block != this) && !block.canReplace(worldIn, pos)) { diff --git a/common/src/main/java/common/block/natural/BlockSnowBlock.java b/common/src/main/java/common/block/natural/BlockSnowBlock.java index e9efc9eb..4b2732eb 100755 --- a/common/src/main/java/common/block/natural/BlockSnowBlock.java +++ b/common/src/main/java/common/block/natural/BlockSnowBlock.java @@ -6,7 +6,7 @@ import common.init.Items; import common.item.CheatTab; import common.item.Item; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.AWorldServer; @@ -26,7 +26,7 @@ public class BlockSnowBlock extends Block { return rand.range(2, 4); } - public void tick(AWorldServer world, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer world, LocalPos pos, State state, Random rand) { if(Vars.snowFullMelt && !world.canFreezeAt(pos)) { this.drop(world, pos, world.getState(pos), 0); world.setBlockToAir(pos); diff --git a/common/src/main/java/common/block/natural/BlockSoulFire.java b/common/src/main/java/common/block/natural/BlockSoulFire.java index d65388f1..7b2504a4 100644 --- a/common/src/main/java/common/block/natural/BlockSoulFire.java +++ b/common/src/main/java/common/block/natural/BlockSoulFire.java @@ -4,7 +4,7 @@ import java.util.Map; import common.model.TextureAnimation; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class BlockSoulFire extends BlockFire { @@ -13,10 +13,10 @@ public class BlockSoulFire extends BlockFire { map.put("soul_fire_layer_1", TextureAnimation.BLUE_FLAME_OFFSET); } - protected void catchOnFire(World world, BlockPos pos, int chance, Random rand, int age) { + protected void catchOnFire(World world, LocalPos pos, int chance, Random rand, int age) { } - protected boolean canDie(World world, BlockPos pos) { + protected boolean canDie(World world, LocalPos pos) { return super.canDie(world, pos) || world.rand.chance(20); } } diff --git a/common/src/main/java/common/block/natural/BlockSoulSand.java b/common/src/main/java/common/block/natural/BlockSoulSand.java index d1da31d5..87695d3a 100755 --- a/common/src/main/java/common/block/natural/BlockSoulSand.java +++ b/common/src/main/java/common/block/natural/BlockSoulSand.java @@ -4,7 +4,7 @@ import common.block.Block; import common.block.Material; import common.entity.Entity; import common.item.CheatTab; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.world.State; import common.world.World; @@ -17,13 +17,13 @@ public class BlockSoulSand extends Block this.setTab(CheatTab.NATURE); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { float f = 0.125F; return new BoundingBox((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)((float)(pos.getY() + 1) - f), (double)(pos.getZ() + 1)); } - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { entityIn.motionX *= 0.4D; entityIn.motionZ *= 0.4D; diff --git a/common/src/main/java/common/block/natural/BlockWeb.java b/common/src/main/java/common/block/natural/BlockWeb.java index 95d113c3..139a41c5 100755 --- a/common/src/main/java/common/block/natural/BlockWeb.java +++ b/common/src/main/java/common/block/natural/BlockWeb.java @@ -11,7 +11,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.model.GuiPosition; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.world.State; import common.world.World; @@ -27,7 +27,7 @@ public class BlockWeb extends Block /** * Called When an Entity Collided with the Block */ - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { entityIn.setInWeb(); } @@ -40,7 +40,7 @@ public class BlockWeb extends Block return false; } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } diff --git a/common/src/main/java/common/block/tech/BlockActiveDisplay.java b/common/src/main/java/common/block/tech/BlockActiveDisplay.java index 3b06bb27..acf636a5 100644 --- a/common/src/main/java/common/block/tech/BlockActiveDisplay.java +++ b/common/src/main/java/common/block/tech/BlockActiveDisplay.java @@ -4,7 +4,7 @@ import common.block.ITileEntityProvider; import common.entity.npc.EntityNPC; import common.tileentity.TileEntity; import common.tileentity.TileEntityDisplay; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Pair; import common.world.AWorldServer; @@ -23,13 +23,13 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi inactive.setActive(this); } - public void onRemoved(AWorldServer world, BlockPos pos, State state) { + public void onRemoved(AWorldServer world, LocalPos pos, State state) { super.onRemoved(world, pos, state); - Pair span = removing ? null : this.getSpan(world, pos, state.getValue(FACING)); + Pair span = removing ? null : this.getSpan(world, pos, state.getValue(FACING)); if(span != null) { world.removeTileEntity(pos); removing = true; - for(BlockPos loc : BlockPos.getAllInBox(span.first(), span.second())) { + for(LocalPos loc : LocalPos.area(span.first(), span.second())) { if(!loc.equals(pos)) world.setState(loc, this.inactive.getState().withProperty(FACING, state.getValue(FACING)), 2); } @@ -45,12 +45,12 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi return false; } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(!worldIn.client) { - Pair span = this.getSpan(worldIn, pos, state.getValue(FACING)); + Pair span = this.getSpan(worldIn, pos, state.getValue(FACING)); if(span == null) return true; - for(BlockPos loc : BlockPos.getAllInBox(span.first(), span.second())) { + for(LocalPos loc : LocalPos.area(span.first(), span.second())) { worldIn.setState(loc, this.inactive.getState().withProperty(FACING, state.getValue(FACING)), 2); } } diff --git a/common/src/main/java/common/block/tech/BlockAnvil.java b/common/src/main/java/common/block/tech/BlockAnvil.java index defab22b..468d965c 100755 --- a/common/src/main/java/common/block/tech/BlockAnvil.java +++ b/common/src/main/java/common/block/tech/BlockAnvil.java @@ -14,7 +14,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Facing; import common.world.IWorldAccess; @@ -66,13 +66,13 @@ public class BlockAnvil extends BlockFalling implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { Facing enumfacing = placer.getHorizontalFacing().rotateY(); return super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(FACING, enumfacing); } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (!worldIn.client) { @@ -82,7 +82,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable return true; } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); @@ -101,12 +101,12 @@ public class BlockAnvil extends BlockFalling implements Rotatable fallingEntity.setHurtEntities(true); } - public void onEndFalling(World worldIn, BlockPos pos) + public void onEndFalling(World worldIn, LocalPos pos) { worldIn.playEffect(1022, pos, 0); } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return true; } @@ -133,9 +133,9 @@ public class BlockAnvil extends BlockFalling implements Rotatable public class Anvil implements InteractionObject { private final World world; - private final BlockPos position; + private final LocalPos position; - public Anvil(World worldIn, BlockPos pos) + public Anvil(World worldIn, LocalPos pos) { this.world = worldIn; this.position = pos; diff --git a/common/src/main/java/common/block/tech/BlockBasePressurePlate.java b/common/src/main/java/common/block/tech/BlockBasePressurePlate.java index aef7f166..175e0236 100755 --- a/common/src/main/java/common/block/tech/BlockBasePressurePlate.java +++ b/common/src/main/java/common/block/tech/BlockBasePressurePlate.java @@ -10,7 +10,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.model.GuiPosition; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.world.IBlockAccess; import common.world.IWorldAccess; @@ -26,7 +26,7 @@ public abstract class BlockBasePressurePlate extends Block this.setTab(CheatTab.TECHNOLOGY); } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { this.setBlockBoundsBasedOnState0(worldIn.getState(pos)); } @@ -49,12 +49,12 @@ public abstract class BlockBasePressurePlate extends Block /** * How many world ticks before ticking */ - public int tickRate(World worldIn, BlockPos pos) + public int tickRate(World worldIn, LocalPos pos) { return 20; } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -72,7 +72,7 @@ public abstract class BlockBasePressurePlate extends Block return false; } - public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + public boolean isPassable(IBlockAccess worldIn, LocalPos pos) { return true; } @@ -85,7 +85,7 @@ public abstract class BlockBasePressurePlate extends Block return true; } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return this.canBePlacedOn(worldIn, pos.down()); } @@ -93,7 +93,7 @@ public abstract class BlockBasePressurePlate extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!this.canBePlacedOn(worldIn, pos.down())) { @@ -102,12 +102,12 @@ public abstract class BlockBasePressurePlate extends Block } } - private boolean canBePlacedOn(World worldIn, BlockPos pos) + private boolean canBePlacedOn(World worldIn, LocalPos pos) { return worldIn.isBlockSolid(pos) || worldIn.getState(pos).getBlock() instanceof BlockFence; } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { // if (!worldIn.client) // { @@ -123,7 +123,7 @@ public abstract class BlockBasePressurePlate extends Block /** * Called When an Entity Collided with the Block */ - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { if (!worldIn.client) { @@ -139,7 +139,7 @@ public abstract class BlockBasePressurePlate extends Block /** * Updates the pressure plate when stepped on */ - protected void updateState(AWorldServer worldIn, BlockPos pos, State state, int oldSignal) + protected void updateState(AWorldServer worldIn, LocalPos pos, State state, int oldSignal) { int i = this.computeSignalStrength(worldIn, pos); boolean flag = oldSignal > 0; @@ -171,13 +171,13 @@ public abstract class BlockBasePressurePlate extends Block /** * Returns the cubic AABB inset by 1/8 on all sides */ - protected BoundingBox getSensitiveAABB(BlockPos pos) + protected BoundingBox getSensitiveAABB(LocalPos pos) { float f = 0.125F; return new BoundingBox((double)((float)pos.getX() + 0.125F), (double)pos.getY(), (double)((float)pos.getZ() + 0.125F), (double)((float)(pos.getX() + 1) - 0.125F), (double)pos.getY() + 0.25D, (double)((float)(pos.getZ() + 1) - 0.125F)); } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { if (this.getSignalStrength(state) > 0) { @@ -190,7 +190,7 @@ public abstract class BlockBasePressurePlate extends Block /** * Notify block and block below of changes */ - protected void updateNeighbors(AWorldServer worldIn, BlockPos pos) + protected void updateNeighbors(AWorldServer worldIn, LocalPos pos) { worldIn.notifyNeighborsOfStateChange(pos, this); worldIn.notifyNeighborsOfStateChange(pos.down(), this); @@ -236,7 +236,7 @@ public abstract class BlockBasePressurePlate extends Block public abstract String getTexture(); - protected abstract int computeSignalStrength(World worldIn, BlockPos pos); + protected abstract int computeSignalStrength(World worldIn, LocalPos pos); protected abstract int getSignalStrength(State state); diff --git a/common/src/main/java/common/block/tech/BlockBrewingStand.java b/common/src/main/java/common/block/tech/BlockBrewingStand.java index 094bef6f..50b8dd12 100755 --- a/common/src/main/java/common/block/tech/BlockBrewingStand.java +++ b/common/src/main/java/common/block/tech/BlockBrewingStand.java @@ -8,7 +8,7 @@ import common.model.Model.ModelProvider; import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.DeviceBrewer; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.Facing; @@ -29,7 +29,7 @@ public class BlockBrewingStand extends BlockMachine { return new DeviceBrewer(); } - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); @@ -37,7 +37,7 @@ public class BlockBrewingStand extends BlockMachine { } @Clientside - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) { + public void displayTick(World worldIn, LocalPos 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); double d2 = (double)((float)pos.getZ() + 0.4F + rand.floatv() * 0.2F); diff --git a/common/src/main/java/common/block/tech/BlockButton.java b/common/src/main/java/common/block/tech/BlockButton.java index 90d7150b..5aeab77a 100755 --- a/common/src/main/java/common/block/tech/BlockButton.java +++ b/common/src/main/java/common/block/tech/BlockButton.java @@ -19,7 +19,7 @@ import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.Serverside; @@ -48,7 +48,7 @@ public class BlockButton extends Block implements Directional BUTTONS.add(this); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -56,7 +56,7 @@ public class BlockButton extends Block implements Directional /** * How many world ticks before ticking */ - public int tickRate(World worldIn, BlockPos pos) + public int tickRate(World worldIn, LocalPos pos) { return this.onTime; } @@ -77,12 +77,12 @@ public class BlockButton extends Block implements Directional /** * Check whether this Block can be placed on the given side */ - public boolean canPlace(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, LocalPos pos, Facing side) { return canPlaceButtonOn(worldIn, pos, side.getOpposite()); } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { for (Facing enumfacing : Facing.values()) { @@ -95,9 +95,9 @@ public class BlockButton extends Block implements Directional return false; } - protected static boolean canPlaceButtonOn(World worldIn, BlockPos pos, Facing face) + protected static boolean canPlaceButtonOn(World worldIn, LocalPos pos, Facing face) { - BlockPos blockpos = pos.offset(face); + LocalPos blockpos = pos.offset(face); return face == Facing.DOWN ? worldIn.isBlockSolid(blockpos) : worldIn.getState(blockpos).getBlock().isNormalCube(); } @@ -105,7 +105,7 @@ public class BlockButton extends Block implements Directional * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return canPlaceButtonOn(worldIn, pos, facing.getOpposite()) ? this.getState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getState().withProperty(FACING, Facing.DOWN).withProperty(POWERED, Boolean.valueOf(false)); } @@ -113,7 +113,7 @@ public class BlockButton extends Block implements Directional /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (this.checkForDrop(worldIn, pos, state) && !canPlaceButtonOn(worldIn, pos, ((Facing)state.getValue(FACING)).getOpposite())) { @@ -122,7 +122,7 @@ public class BlockButton extends Block implements Directional } } - private boolean checkForDrop(World worldIn, BlockPos pos, State state) + private boolean checkForDrop(World worldIn, LocalPos pos, State state) { if (this.canPlace(worldIn, pos)) { @@ -136,7 +136,7 @@ public class BlockButton extends Block implements Directional } } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { this.updateBlockBounds(worldIn.getState(pos)); } @@ -178,7 +178,7 @@ public class BlockButton extends Block implements Directional } } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (((Boolean)state.getValue(POWERED)).booleanValue()) { @@ -197,7 +197,7 @@ public class BlockButton extends Block implements Directional } } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { if (((Boolean)state.getValue(POWERED)).booleanValue()) { @@ -208,7 +208,7 @@ public class BlockButton extends Block implements Directional } @Serverside - public double getResistance(AWorldServer worldIn, BlockPos pos, State state) { + public double getResistance(AWorldServer worldIn, LocalPos pos, State state) { return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state); } @@ -220,7 +220,7 @@ public class BlockButton extends Block implements Directional return true; } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { // if (!worldIn.client) // { @@ -244,7 +244,7 @@ public class BlockButton extends Block implements Directional /** * Called When an Entity Collided with the Block */ - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { if (!worldIn.client) { @@ -258,7 +258,7 @@ public class BlockButton extends Block implements Directional } } - private void checkForArrows(AWorldServer worldIn, BlockPos pos, State state) + private void checkForArrows(AWorldServer worldIn, LocalPos pos, State state) { this.updateBlockBounds(state); List list = worldIn.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)); @@ -287,7 +287,7 @@ public class BlockButton extends Block implements Directional } } - private void notifyNeighbors(AWorldServer worldIn, BlockPos pos, Facing facing) + private void notifyNeighbors(AWorldServer worldIn, LocalPos pos, Facing facing) { worldIn.notifyNeighborsOfStateChange(pos, this); worldIn.notifyNeighborsOfStateChange(pos.offset(facing.getOpposite()), this); diff --git a/common/src/main/java/common/block/tech/BlockCauldron.java b/common/src/main/java/common/block/tech/BlockCauldron.java index 4578c0e9..89cc59b6 100755 --- a/common/src/main/java/common/block/tech/BlockCauldron.java +++ b/common/src/main/java/common/block/tech/BlockCauldron.java @@ -14,7 +14,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyInteger; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.Facing; @@ -36,7 +36,7 @@ public class BlockCauldron extends Block /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F); super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); @@ -68,7 +68,7 @@ public class BlockCauldron extends Block /** * Called When an Entity Collided with the Block */ - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { int i = ((Integer)state.getValue(LEVEL)).intValue(); float f = (float)pos.getY() + (6.0F + (float)(3 * i)) / 16.0F; @@ -80,7 +80,7 @@ public class BlockCauldron extends Block } } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -160,13 +160,13 @@ public class BlockCauldron extends Block } } - public void setWaterLevel(World worldIn, BlockPos pos, State state, int level) + public void setWaterLevel(World worldIn, LocalPos pos, State state, int level) { worldIn.setState(pos, state.withProperty(LEVEL, Integer.valueOf(ExtMath.clampi(level, 0, 3))), 2); } @Serverside - public void onRain(AWorldServer worldIn, BlockPos pos) + public void onRain(AWorldServer worldIn, LocalPos pos) { if (worldIn.rand.chance(20)) // == 1 { diff --git a/common/src/main/java/common/block/tech/BlockChest.java b/common/src/main/java/common/block/tech/BlockChest.java index 3a832a34..2b724632 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -27,7 +27,7 @@ import common.properties.Property; import common.properties.PropertyBool; import common.tileentity.TileEntity; import common.tileentity.TileEntityChest; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.Facing; @@ -81,12 +81,12 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable return false; } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } - public State correctFacing(World worldIn, BlockPos pos, State state) + public State correctFacing(World worldIn, LocalPos pos, State state) { Facing enumfacing = null; @@ -138,7 +138,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable } } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { TileEntity tileentity = worldIn.getTileEntity(pos); @@ -150,7 +150,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable super.onRemoved(worldIn, pos, state); } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -196,7 +196,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable } } - public TileEntityChest getChest(World worldIn, BlockPos pos) + public TileEntityChest getChest(World worldIn, LocalPos pos) { TileEntity tileentity = worldIn.getTileEntity(pos); if (!(tileentity instanceof TileEntityChest chest)) @@ -211,17 +211,17 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable return new TileEntityChest(this.width * this.height); } - private boolean isBlocked(World worldIn, BlockPos pos) + private boolean isBlocked(World worldIn, LocalPos pos) { return this.isBelowSolidBlock(worldIn, pos) || this.isCatSittingOnChest(worldIn, pos); } - private boolean isBelowSolidBlock(World worldIn, BlockPos pos) + private boolean isBelowSolidBlock(World worldIn, LocalPos pos) { return worldIn.getState(pos.up()).getBlock().isNormalCube(); } - private boolean isCatSittingOnChest(World worldIn, BlockPos pos) + private boolean isCatSittingOnChest(World worldIn, LocalPos pos) { for (Entity entity : worldIn.getEntitiesWithinAABB(EntityCat.class, new BoundingBox((double)pos.getX(), (double)(pos.getY() + 1), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 2), (double)(pos.getZ() + 1)))) { @@ -246,7 +246,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable return new Property[] {OPEN}; } - public State getState(State state, IWorldAccess world, BlockPos pos) { + public State getState(State state, IWorldAccess world, LocalPos pos) { TileEntity te = world.getTileEntity(pos); if(te instanceof TileEntityChest chest) return state.withProperty(OPEN, chest.numPlayersUsing > 0); @@ -265,7 +265,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable } @Clientside - public String getInfo(World world, BlockPos pos, State state, EntityNPC player) { + public String getInfo(World world, LocalPos pos, State state, EntityNPC player) { return Color.DARK_GREEN + "Kapazität für " + Color.GREEN + (this.width * this.height) + Color.DARK_GREEN + " Gegenstände"; } diff --git a/common/src/main/java/common/block/tech/BlockCore.java b/common/src/main/java/common/block/tech/BlockCore.java index 3d3851a1..04a334d5 100755 --- a/common/src/main/java/common/block/tech/BlockCore.java +++ b/common/src/main/java/common/block/tech/BlockCore.java @@ -3,7 +3,7 @@ package common.block.tech; import common.block.Block; import common.block.Material; import common.item.CheatTab; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.AWorldServer; @@ -14,13 +14,13 @@ public class BlockCore extends Block { this.setTab(CheatTab.TECHNOLOGY); } - public void onRemoved(AWorldServer world, BlockPos pos, State state) + public void onRemoved(AWorldServer world, LocalPos pos, State state) { if(Vars.loaders) world.removeLoader(pos); } - public void onAdded(AWorldServer world, BlockPos pos, State state) + public void onAdded(AWorldServer world, LocalPos pos, State state) { if(Vars.loaders) world.addLoader(pos); diff --git a/common/src/main/java/common/block/tech/BlockDirectionalPipe.java b/common/src/main/java/common/block/tech/BlockDirectionalPipe.java index 846102f7..2577c4ae 100644 --- a/common/src/main/java/common/block/tech/BlockDirectionalPipe.java +++ b/common/src/main/java/common/block/tech/BlockDirectionalPipe.java @@ -4,7 +4,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyBool; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.Facing; import common.world.IWorldAccess; @@ -22,7 +22,7 @@ public abstract class BlockDirectionalPipe extends BlockPipe { this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.DOWN).withProperty(DOWN, false).withProperty(UP, false).withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false)); } - public State getState(State state, IWorldAccess world, BlockPos pos) { + public State getState(State state, IWorldAccess world, LocalPos pos) { return state.withProperty(DOWN, this.canConnectTo(world.getState(pos.down()).getBlock())) .withProperty(UP, this.canConnectTo(world.getState(pos.up()).getBlock())) .withProperty(NORTH, this.canConnectTo(world.getState(pos.north()).getBlock())) diff --git a/common/src/main/java/common/block/tech/BlockDispenser.java b/common/src/main/java/common/block/tech/BlockDispenser.java index 02d10e8d..a64cc2fa 100755 --- a/common/src/main/java/common/block/tech/BlockDispenser.java +++ b/common/src/main/java/common/block/tech/BlockDispenser.java @@ -7,7 +7,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.tileentity.TileEntity; import common.tileentity.DeviceDispenser; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Vec3; import common.world.State; @@ -17,7 +17,7 @@ public class BlockDispenser extends BlockMachine { private final boolean dropItems; public static void dispense(AWorldServer world, double speed, Facing facing, Vec3 position, ItemStack stack) { - EntityItem entity = new EntityItem(world, position.xCoord, position.yCoord - (facing.getAxis() == Facing.Axis.Y ? 0.125 : 0.15625), position.zCoord, stack); + EntityItem entity = new EntityItem(world, position.x, position.y - (facing.getAxis() == Facing.Axis.Y ? 0.125 : 0.15625), position.z, stack); double velo = world.rand.doublev() * 0.1 + 0.2; entity.motionX = (double)facing.getFrontOffsetX() * velo + world.rand.gaussian() * 0.0075 * speed; entity.motionY = 0.2 + world.rand.gaussian() * 0.0075 * speed; @@ -25,7 +25,7 @@ public class BlockDispenser extends BlockMachine { world.spawnEntityInWorld(entity); } - public static Vec3 getDispensePosition(BlockPos pos, Facing facing) { + public static Vec3 getDispensePosition(LocalPos pos, Facing facing) { double d0 = pos.getX() + 0.5 + 0.7D * (double)facing.getFrontOffsetX(); double d1 = pos.getY() + 0.5 + 0.7D * (double)facing.getFrontOffsetY(); double d2 = pos.getZ() + 0.5 + 0.7D * (double)facing.getFrontOffsetZ(); diff --git a/common/src/main/java/common/block/tech/BlockDisplay.java b/common/src/main/java/common/block/tech/BlockDisplay.java index f9b95217..e193807d 100644 --- a/common/src/main/java/common/block/tech/BlockDisplay.java +++ b/common/src/main/java/common/block/tech/BlockDisplay.java @@ -15,7 +15,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.model.GuiPosition; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.Pair; @@ -40,7 +40,7 @@ public abstract class BlockDisplay extends Block implements Rotatable return this.density; } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos); @@ -74,13 +74,13 @@ public abstract class BlockDisplay extends Block implements Rotatable return new Property[] {FACING}; } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { this.setBlockBounds(worldIn, pos); return super.getCollisionBox(worldIn, pos, state); } - public BoundingBox getSelectionBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, LocalPos pos) { this.setBlockBounds(worldIn, pos); return super.getSelectionBox(worldIn, pos); @@ -106,11 +106,11 @@ public abstract class BlockDisplay extends Block implements Rotatable return true; } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, facing.getAxis().isVertical() ? placer.getHorizontalFacing().getOpposite() : facing); } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return true; } @@ -125,7 +125,7 @@ public abstract class BlockDisplay extends Block implements Rotatable protected abstract BlockDisplay getOtherBlock(); - private boolean test(World world, BlockPos pos, BlockPos origin, Facing dir) { + private boolean test(World world, LocalPos pos, LocalPos origin, Facing dir) { int radius = 9; if(pos.getX() < origin.getX() - radius || pos.getX() > origin.getX() + radius) return false; @@ -137,23 +137,23 @@ public abstract class BlockDisplay extends Block implements Rotatable return (state.getBlock() == this || state.getBlock() == this.getOtherBlock()) && state.getValue(FACING) == dir; } - protected Pair getSpan(World world, BlockPos origin, Facing dir) { - Queue queue = new ArrayDeque(); - Set present = new HashSet(); - Set visited = new HashSet(); + protected Pair getSpan(World world, LocalPos origin, Facing dir) { + Queue queue = new ArrayDeque(); + Set present = new HashSet(); + Set visited = new HashSet(); Facing[] dirs = new Facing[] {Facing.UP, Facing.DOWN, dir.rotateY(), dir.rotateYCCW()}; present.add(origin); visited.add(origin); for(Facing off : dirs) { - BlockPos pos = origin.offset(off); + LocalPos pos = origin.offset(off); if(!visited.contains(pos)) { if(test(world, pos, origin, dir)) queue.add(pos); visited.add(pos); } } - BlockPos loc; + LocalPos loc; int minX = origin.getX(); int minY = origin.getY(); int minZ = origin.getZ(); @@ -169,7 +169,7 @@ public abstract class BlockDisplay extends Block implements Rotatable maxY = Math.max(maxY, loc.getY()); maxZ = Math.max(maxZ, loc.getZ()); for(Facing off : dirs) { - BlockPos pos = loc.offset(off); + LocalPos pos = loc.offset(off); if(!visited.contains(pos)) { visited.add(pos); if(test(world, pos, origin, dir)) @@ -179,9 +179,9 @@ public abstract class BlockDisplay extends Block implements Rotatable } if(maxX - minX >= 8 || maxY - minY >= 8 || maxZ - minZ >= 8) return null; - BlockPos min = new BlockPos(minX, minY, minZ); - BlockPos max = new BlockPos(maxX, maxY, maxZ); - for(BlockPos pos : BlockPos.getAllInBox(min, max)) { + LocalPos min = new LocalPos(minX, minY, minZ); + LocalPos max = new LocalPos(maxX, maxY, maxZ); + for(LocalPos pos : LocalPos.area(min, max)) { if(!present.contains(pos)) return null; } diff --git a/common/src/main/java/common/block/tech/BlockEnchantmentTable.java b/common/src/main/java/common/block/tech/BlockEnchantmentTable.java index c6c1a791..ebac1bca 100755 --- a/common/src/main/java/common/block/tech/BlockEnchantmentTable.java +++ b/common/src/main/java/common/block/tech/BlockEnchantmentTable.java @@ -8,7 +8,7 @@ import common.inventory.ContainerEnchantment; import common.item.CheatTab; import common.model.Model; import common.model.Model.ModelProvider; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -33,7 +33,7 @@ public class BlockEnchantmentTable extends Block return false; } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -60,9 +60,9 @@ public class BlockEnchantmentTable extends Block public class Enchanter implements InteractionObject { private final World world; - private final BlockPos position; + private final LocalPos position; - public Enchanter(World worldIn, BlockPos pos) + public Enchanter(World worldIn, LocalPos pos) { this.world = worldIn; this.position = pos; diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index c9841928..6f721dc6 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -13,7 +13,7 @@ import common.model.ModelRotation; import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.DeviceFurnace; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.Color; import common.util.Facing; @@ -55,12 +55,12 @@ public class BlockFurnace extends BlockMachine { return this.isBurning; } - public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { + public void onAdded(AWorldServer worldIn, LocalPos pos, State state) { super.onAdded(worldIn, pos, state); this.setDefaultFacing(worldIn, pos, state); } - private void setDefaultFacing(World worldIn, BlockPos pos, State state) { + private void setDefaultFacing(World worldIn, LocalPos pos, State state) { if(!worldIn.client) { Block block = worldIn.getState(pos.north()).getBlock(); Block block1 = worldIn.getState(pos.south()).getBlock(); @@ -86,7 +86,7 @@ public class BlockFurnace extends BlockMachine { } @Clientside - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) { + public void displayTick(World worldIn, LocalPos pos, State state, Random rand) { if(this.isBurning) { Facing enumfacing = (Facing)state.getValue(FACING); double d0 = (double)pos.getX() + 0.5D; @@ -118,7 +118,7 @@ public class BlockFurnace extends BlockMachine { } } - public void setState(boolean active, World worldIn, BlockPos pos) { + public void setState(boolean active, World worldIn, LocalPos pos) { BlockFurnace block = this.isBurning == active ? this : this.other; State iblockstate = worldIn.getState(pos); if(iblockstate.getBlock() == block) @@ -138,7 +138,7 @@ public class BlockFurnace extends BlockMachine { return new DeviceFurnace(this.burnTime, this.fuelEfficiency); } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { if(!keepInventory) super.onRemoved(worldIn, pos, state); } @@ -165,7 +165,7 @@ public class BlockFurnace extends BlockMachine { } @Clientside - public String getInfo(World world, BlockPos pos, State state, EntityNPC player) { + public String getInfo(World world, LocalPos pos, State state, EntityNPC player) { return Color.DARK_GREEN + "Schmelzzeit: " + Color.GREEN + (this.burnTime / 20) + " s" + Color.DARK_GRAY + " | " + Color.CYAN + "Effizienz: " + Color.NEON + this.fuelEfficiency + " %"; } } diff --git a/common/src/main/java/common/block/tech/BlockHook.java b/common/src/main/java/common/block/tech/BlockHook.java index 88c2559b..ee517f73 100755 --- a/common/src/main/java/common/block/tech/BlockHook.java +++ b/common/src/main/java/common/block/tech/BlockHook.java @@ -13,7 +13,7 @@ import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.Serverside; @@ -34,7 +34,7 @@ public class BlockHook extends Block implements Rotatable this.setTab(CheatTab.TECHNOLOGY); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -55,12 +55,12 @@ public class BlockHook extends Block implements Rotatable /** * Check whether this Block can be placed on the given side */ - public boolean canPlace(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, LocalPos pos, Facing side) { return side.getAxis().isHorizontal() && worldIn.getState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { for (Facing enumfacing : Facing.Plane.HORIZONTAL) { @@ -77,7 +77,7 @@ public class BlockHook extends Block implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = this.getState().withProperty(TRIGGERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)); @@ -92,7 +92,7 @@ public class BlockHook extends Block implements Rotatable /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ - public void onPlace(World worldIn, BlockPos pos, State state, EntityLiving placer) + public void onPlace(World worldIn, LocalPos pos, State state, EntityLiving placer) { if(!worldIn.client) this.triggerHookAt((AWorldServer)worldIn, pos, state, false, false, -1, (State)null); @@ -101,7 +101,7 @@ public class BlockHook extends Block implements Rotatable /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (neighborBlock != this) { @@ -118,7 +118,7 @@ public class BlockHook extends Block implements Rotatable } } - public void triggerHookAt(AWorldServer worldIn, BlockPos pos, State hookState, boolean removed, boolean triggered, int wireDist, State wireState) + public void triggerHookAt(AWorldServer worldIn, LocalPos pos, State hookState, boolean removed, boolean triggered, int wireDist, State wireState) { Facing enumfacing = (Facing)hookState.getValue(FACING); boolean attached = ((Boolean)hookState.getValue(ATTACHED)).booleanValue(); @@ -130,7 +130,7 @@ public class BlockHook extends Block implements Rotatable for (int j = 1; j < 42; ++j) { - BlockPos blockpos = pos.offset(enumfacing, j); + LocalPos blockpos = pos.offset(enumfacing, j); State iblockstate = worldIn.getState(blockpos); if (iblockstate.getBlock() instanceof BlockHook) @@ -172,7 +172,7 @@ public class BlockHook extends Block implements Rotatable if (i > 0) { - BlockPos blockpos1 = pos.offset(enumfacing, i); + LocalPos blockpos1 = pos.offset(enumfacing, i); Facing enumfacing1 = enumfacing.getOpposite(); worldIn.setState(blockpos1, iblockstate1.withProperty(FACING, enumfacing1), 3); this.notifyTriggered(worldIn, blockpos1, enumfacing1); @@ -195,7 +195,7 @@ public class BlockHook extends Block implements Rotatable { for (int k = 1; k < i; ++k) { - BlockPos blockpos2 = pos.offset(enumfacing, k); + LocalPos blockpos2 = pos.offset(enumfacing, k); State iblockstate2 = aiblockstate[k]; if (iblockstate2 != null && worldIn.getState(blockpos2).getBlock() instanceof BlockHook) @@ -206,12 +206,12 @@ public class BlockHook extends Block implements Rotatable } } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { this.triggerHookAt(worldIn, pos, state, false, true, -1, (State)null); } - private void playerTriggerSounds(AWorldServer worldIn, BlockPos pos, boolean attached, boolean powered, boolean wasAttached, boolean wasPowered) + private void playerTriggerSounds(AWorldServer worldIn, LocalPos pos, boolean attached, boolean powered, boolean wasAttached, boolean wasPowered) { if (powered && !wasPowered) { @@ -231,13 +231,13 @@ public class BlockHook extends Block implements Rotatable } } - private void notifyTriggered(AWorldServer worldIn, BlockPos pos, Facing face) + private void notifyTriggered(AWorldServer worldIn, LocalPos pos, Facing face) { worldIn.notifyNeighborsOfStateChange(pos, this); worldIn.notifyNeighborsOfStateChange(pos.offset(face.getOpposite()), this); } - private boolean checkForDrop(World worldIn, BlockPos pos, State state) + private boolean checkForDrop(World worldIn, LocalPos pos, State state) { if (!this.canPlace(worldIn, pos)) { @@ -252,7 +252,7 @@ public class BlockHook extends Block implements Rotatable } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { float f = 0.1875F; @@ -275,7 +275,7 @@ public class BlockHook extends Block implements Rotatable } } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { boolean flag = ((Boolean)state.getValue(ATTACHED)).booleanValue(); boolean flag1 = ((Boolean)state.getValue(TRIGGERED)).booleanValue(); @@ -295,7 +295,7 @@ public class BlockHook extends Block implements Rotatable } @Serverside - public double getResistance(AWorldServer worldIn, BlockPos pos, State state) { + public double getResistance(AWorldServer worldIn, LocalPos pos, State state) { return state.getValue(TRIGGERED) ? 0.0 : super.getResistance(worldIn, pos, state); } diff --git a/common/src/main/java/common/block/tech/BlockInactiveDisplay.java b/common/src/main/java/common/block/tech/BlockInactiveDisplay.java index e2d1a542..c2efbdb9 100644 --- a/common/src/main/java/common/block/tech/BlockInactiveDisplay.java +++ b/common/src/main/java/common/block/tech/BlockInactiveDisplay.java @@ -5,7 +5,7 @@ import java.util.Arrays; import common.entity.npc.EntityNPC; import common.tileentity.TileEntity; import common.tileentity.TileEntityDisplay; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Pair; import common.world.State; @@ -22,12 +22,12 @@ public class BlockInactiveDisplay extends BlockDisplay { this.active = active; } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(!worldIn.client) { - Pair span = this.getSpan(worldIn, pos, state.getValue(FACING)); + Pair span = this.getSpan(worldIn, pos, state.getValue(FACING)); if(span == null) return true; - for(BlockPos loc : BlockPos.getAllInBox(span.first(), span.second())) { + for(LocalPos loc : LocalPos.area(span.first(), span.second())) { worldIn.setState(loc, this.active.getState().withProperty(FACING, state.getValue(FACING)), 2); TileEntity tileentity = worldIn.getTileEntity(loc); if(tileentity instanceof TileEntityDisplay display) { diff --git a/common/src/main/java/common/block/tech/BlockLever.java b/common/src/main/java/common/block/tech/BlockLever.java index 50eb57af..6ad257a5 100755 --- a/common/src/main/java/common/block/tech/BlockLever.java +++ b/common/src/main/java/common/block/tech/BlockLever.java @@ -13,7 +13,7 @@ import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyBool; import common.properties.PropertyEnum; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.DirectionVec; import common.util.Facing; @@ -36,7 +36,7 @@ public class BlockLever extends Block this.setTab(CheatTab.TECHNOLOGY); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -57,12 +57,12 @@ public class BlockLever extends Block /** * Check whether this Block can be placed on the given side */ - public boolean canPlace(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, LocalPos pos, Facing side) { return canPlaceLeverOn(worldIn, pos, side.getOpposite()); } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { for (Facing enumfacing : Facing.values()) { @@ -75,7 +75,7 @@ public class BlockLever extends Block return false; } - protected static boolean canPlaceLeverOn(World worldIn, BlockPos pos, Facing face) + protected static boolean canPlaceLeverOn(World worldIn, LocalPos pos, Facing face) { return BlockButton.canPlaceButtonOn(worldIn, pos, face); } @@ -84,7 +84,7 @@ public class BlockLever extends Block * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = this.getState().withProperty(POWERED, Boolean.valueOf(false)); @@ -143,7 +143,7 @@ public class BlockLever extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (this.checkDrop(worldIn, pos, state) && !canPlaceLeverOn(worldIn, pos, ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite())) { @@ -152,7 +152,7 @@ public class BlockLever extends Block } } - private boolean checkDrop(World worldIn, BlockPos pos, State state) + private boolean checkDrop(World worldIn, LocalPos pos, State state) { if (this.canPlace(worldIn, pos)) { @@ -166,7 +166,7 @@ public class BlockLever extends Block } } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { float f = 0.1875F; @@ -201,7 +201,7 @@ public class BlockLever extends Block } } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -219,7 +219,7 @@ public class BlockLever extends Block } } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { if (((Boolean)state.getValue(POWERED)).booleanValue()) { @@ -232,7 +232,7 @@ public class BlockLever extends Block } @Serverside - public double getResistance(AWorldServer worldIn, BlockPos pos, State state) { + public double getResistance(AWorldServer worldIn, LocalPos pos, State state) { return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state); } diff --git a/common/src/main/java/common/block/tech/BlockLitTorch.java b/common/src/main/java/common/block/tech/BlockLitTorch.java index 8e22e07a..67c1307a 100755 --- a/common/src/main/java/common/block/tech/BlockLitTorch.java +++ b/common/src/main/java/common/block/tech/BlockLitTorch.java @@ -7,7 +7,7 @@ import common.item.Item; import common.properties.Property; import common.properties.PropertyInteger; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.ParticleType; import common.vars.Vars; @@ -28,7 +28,7 @@ public class BlockLitTorch extends BlockTorch { this.setTicked(); } - public void extinguish(AWorldServer worldIn, BlockPos pos, State state, Random rand) { + public void extinguish(AWorldServer worldIn, LocalPos pos, State state, Random rand) { worldIn.setState(pos, this.unlit.getState().withProperty(FACING, state.getValue(FACING)), 3); worldIn.sendSound(SoundEvent.FIZZ, (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 0.5F); @@ -40,7 +40,7 @@ public class BlockLitTorch extends BlockTorch { } } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { if(Vars.torchBurnout > 0 && rand.chance(Vars.torchBurnout)) { int fuel = state.getValue(FUEL); if(fuel <= 0) { @@ -52,7 +52,7 @@ public class BlockLitTorch extends BlockTorch { } } - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) { + public void displayTick(World worldIn, LocalPos pos, State state, Random rand) { if(this.unlit.getParticleColor() == 0xffffffff) { Facing enumfacing = (Facing)state.getValue(FACING); double d0 = (double)pos.getX() + 0.5D; @@ -91,7 +91,7 @@ public class BlockLitTorch extends BlockTorch { } } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(!worldIn.client) this.extinguish((AWorldServer)worldIn, pos, state, worldIn.rand); return true; diff --git a/common/src/main/java/common/block/tech/BlockMachine.java b/common/src/main/java/common/block/tech/BlockMachine.java index e6333a2e..512e47d0 100755 --- a/common/src/main/java/common/block/tech/BlockMachine.java +++ b/common/src/main/java/common/block/tech/BlockMachine.java @@ -10,7 +10,7 @@ import common.item.CheatTab; import common.properties.Property; import common.tileentity.TileEntity; import common.tileentity.Device; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -29,7 +29,7 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti public abstract TileEntity createNewTileEntity(); - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(worldIn.client) return true; @@ -39,7 +39,7 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti return true; } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { TileEntity tileentity = worldIn.getTileEntity(pos); if(tileentity instanceof Device) { dropItems(worldIn, pos, (Device)tileentity); @@ -47,7 +47,7 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti super.onRemoved(worldIn, pos, state); } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } diff --git a/common/src/main/java/common/block/tech/BlockNuke.java b/common/src/main/java/common/block/tech/BlockNuke.java index 02a7af1b..002b83c5 100755 --- a/common/src/main/java/common/block/tech/BlockNuke.java +++ b/common/src/main/java/common/block/tech/BlockNuke.java @@ -12,7 +12,7 @@ import common.item.CheatTab; import common.item.Item; import common.model.Model; import common.model.Model.ModelProvider; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Color; import common.util.Facing; import common.world.State; @@ -26,7 +26,7 @@ public class BlockNuke extends Block this.setTab(CheatTab.TECHNOLOGY); } - public void onDestroyedExplosion(World worldIn, BlockPos pos, EntityLiving source, State prevState) + public void onDestroyedExplosion(World worldIn, LocalPos pos, EntityLiving source, State prevState) { if (!worldIn.client) { @@ -34,7 +34,7 @@ public class BlockNuke extends Block } } - public void explode(World worldIn, BlockPos pos, EntityLiving source) + public void explode(World worldIn, LocalPos pos, EntityLiving source) { if (!worldIn.client) { @@ -44,7 +44,7 @@ public class BlockNuke extends Block } } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(playerIn.getHeldItem() != null) { Item item = playerIn.getHeldItem().getItem(); if(item == Items.charged_powder) { diff --git a/common/src/main/java/common/block/tech/BlockPipe.java b/common/src/main/java/common/block/tech/BlockPipe.java index 51c5d082..6d494306 100755 --- a/common/src/main/java/common/block/tech/BlockPipe.java +++ b/common/src/main/java/common/block/tech/BlockPipe.java @@ -16,7 +16,7 @@ import common.model.Model; import common.model.Model.ModelProvider; import common.tileentity.TileEntity; import common.tileentity.TileEntityItemPipe; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.Facing; @@ -36,13 +36,13 @@ public abstract class BlockPipe extends Block implements ITileEntityProvider, Di public abstract boolean canConnectTo(Block block); - public final void setBlockBounds(IWorldAccess world, BlockPos pos) { + public final void setBlockBounds(IWorldAccess world, LocalPos pos) { this.setBlockBounds(this.canConnectTo(world.getState(pos.west()).getBlock()) ? 0.0f : 0.25f, this.canConnectTo(world.getState(pos.down()).getBlock()) ? 0.0f : 0.25f, this.canConnectTo(world.getState(pos.north()).getBlock()) ? 0.0f : 0.25f, this.canConnectTo(world.getState(pos.east()).getBlock()) ? 1.0f : 0.75f, this.canConnectTo(world.getState(pos.up()).getBlock()) ? 1.0f : 0.75f, this.canConnectTo(world.getState(pos.south()).getBlock()) ? 1.0f : 0.75f); } - public final void getCollisionBoxes(World world, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { + public final void getCollisionBoxes(World world, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f); super.getCollisionBoxes(world, pos, state, mask, list, collidingEntity); if(this.canConnectTo(world.getState(pos.west()).getBlock())) { @@ -72,11 +72,11 @@ public abstract class BlockPipe extends Block implements ITileEntityProvider, Di this.setBlockBounds(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f); } - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, facing.getOpposite()); } - public boolean onUse(World world, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World world, LocalPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(); if(stack == null || stack.getItem() != Items.hoe) return false; @@ -104,7 +104,7 @@ public abstract class BlockPipe extends Block implements ITileEntityProvider, Di return true; } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { if(!keepInventory) { TileEntity tileentity = worldIn.getTileEntity(pos); if(tileentity instanceof TileEntityItemPipe) @@ -121,7 +121,7 @@ public abstract class BlockPipe extends Block implements ITileEntityProvider, Di } @Clientside - public final boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { + public final boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return true; } diff --git a/common/src/main/java/common/block/tech/BlockPistonBase.java b/common/src/main/java/common/block/tech/BlockPistonBase.java index ae98ff2d..e5a3850e 100755 --- a/common/src/main/java/common/block/tech/BlockPistonBase.java +++ b/common/src/main/java/common/block/tech/BlockPistonBase.java @@ -18,7 +18,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.properties.Property; import common.properties.PropertyBool; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.Facing; @@ -33,13 +33,13 @@ public class BlockPistonBase extends Block implements Directional private static class BlockPistonStructureHelper { private final AWorldServer world; - private final BlockPos pistonPos; - private final BlockPos blockToMove; + private final LocalPos pistonPos; + private final LocalPos blockToMove; private final Facing moveDirection; - private final List toMove = Lists.newArrayList(); - private final List toDestroy = Lists.newArrayList(); + private final List toMove = Lists.newArrayList(); + private final List toDestroy = Lists.newArrayList(); - public BlockPistonStructureHelper(AWorldServer worldIn, BlockPos posIn, Facing pistonFacing, boolean extending) + public BlockPistonStructureHelper(AWorldServer worldIn, LocalPos posIn, Facing pistonFacing, boolean extending) { this.world = worldIn; this.pistonPos = posIn; @@ -82,7 +82,7 @@ public class BlockPistonBase extends Block implements Directional { for (int i = 0; i < this.toMove.size(); ++i) { - BlockPos blockpos = (BlockPos)this.toMove.get(i); + LocalPos blockpos = (LocalPos)this.toMove.get(i); if (this.world.getState(blockpos).getBlock() == Blocks.slime_block && !this.canSlide(blockpos)) { @@ -94,7 +94,7 @@ public class BlockPistonBase extends Block implements Directional } } - private boolean canPistonSlide(BlockPos origin) + private boolean canPistonSlide(LocalPos origin) { Block block = this.world.getState(origin).getBlock(); @@ -126,7 +126,7 @@ public class BlockPistonBase extends Block implements Directional { while (block == Blocks.slime_block) { - BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); + LocalPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); block = this.world.getState(blockpos).getBlock(); if (block == Blocks.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) @@ -154,7 +154,7 @@ public class BlockPistonBase extends Block implements Directional while (true) { - BlockPos blockpos1 = origin.offset(this.moveDirection, j1); + LocalPos blockpos1 = origin.offset(this.moveDirection, j1); int k = this.toMove.indexOf(blockpos1); if (k > -1) @@ -163,7 +163,7 @@ public class BlockPistonBase extends Block implements Directional for (int l = 0; l <= k + i1; ++l) { - BlockPos blockpos2 = (BlockPos)this.toMove.get(l); + LocalPos blockpos2 = (LocalPos)this.toMove.get(l); if (this.world.getState(blockpos2).getBlock() == Blocks.slime_block && !this.canSlide(blockpos2)) { @@ -207,9 +207,9 @@ public class BlockPistonBase extends Block implements Directional private void reorderMoveList(int splitA, int splitB) { - List list = Lists.newArrayList(); - List list1 = Lists.newArrayList(); - List list2 = Lists.newArrayList(); + List list = Lists.newArrayList(); + List list1 = Lists.newArrayList(); + List list2 = Lists.newArrayList(); list.addAll(this.toMove.subList(0, splitB)); list1.addAll(this.toMove.subList(this.toMove.size() - splitA, this.toMove.size())); list2.addAll(this.toMove.subList(splitB, this.toMove.size() - splitA)); @@ -219,7 +219,7 @@ public class BlockPistonBase extends Block implements Directional this.toMove.addAll(list2); } - private boolean canSlide(BlockPos pos) + private boolean canSlide(LocalPos pos) { for (Facing enumfacing : Facing.values()) { @@ -232,12 +232,12 @@ public class BlockPistonBase extends Block implements Directional return true; } - public List getBlocksToMove() + public List getBlocksToMove() { return this.toMove; } - public List getBlocksToDestroy() + public List getBlocksToDestroy() { return this.toDestroy; } @@ -270,7 +270,7 @@ public class BlockPistonBase extends Block implements Directional /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ - public void onPlace(World worldIn, BlockPos pos, State state, EntityLiving placer) + public void onPlace(World worldIn, LocalPos pos, State state, EntityLiving placer) { worldIn.setState(pos, state.withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)), 2); @@ -283,7 +283,7 @@ public class BlockPistonBase extends Block implements Directional /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!worldIn.client) { @@ -291,7 +291,7 @@ public class BlockPistonBase extends Block implements Directional } } - public void onAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, LocalPos pos, State state) { if (!worldIn.client && worldIn.getTileEntity(pos) == null) { @@ -303,12 +303,12 @@ public class BlockPistonBase extends Block implements Directional * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)).withProperty(EXTENDED, Boolean.valueOf(false)); } - private void checkForMove(AWorldServer worldIn, BlockPos pos, State state) + private void checkForMove(AWorldServer worldIn, LocalPos pos, State state) { Facing enumfacing = (Facing)state.getValue(FACING); boolean flag = this.shouldBeExtended(worldIn, pos, enumfacing); @@ -331,7 +331,7 @@ public class BlockPistonBase extends Block implements Directional worldIn.setState(pos, state.withProperty(EXTENDED, Boolean.valueOf(false)), 2); if (this.isSticky) { - BlockPos blockpos = pos.add(enumfacing.getFrontOffsetX() * 2, enumfacing.getFrontOffsetY() * 2, enumfacing.getFrontOffsetZ() * 2); + LocalPos blockpos = pos.add(enumfacing.getFrontOffsetX() * 2, enumfacing.getFrontOffsetY() * 2, enumfacing.getFrontOffsetZ() * 2); Block block = worldIn.getState(blockpos).getBlock(); if (block != Blocks.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) @@ -348,7 +348,7 @@ public class BlockPistonBase extends Block implements Directional } } - private boolean shouldBeExtended(AWorldServer worldIn, BlockPos pos, Facing facing) + private boolean shouldBeExtended(AWorldServer worldIn, LocalPos pos, Facing facing) { // for (Facing enumfacing : Facing.values()) // { @@ -378,7 +378,7 @@ public class BlockPistonBase extends Block implements Directional // } } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos); @@ -425,13 +425,13 @@ public class BlockPistonBase extends Block implements Directional /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { this.setBlockBounds(worldIn, pos); return super.getCollisionBox(worldIn, pos, state); @@ -442,7 +442,7 @@ public class BlockPistonBase extends Block implements Directional return false; } - public static Facing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLiving entityIn) + public static Facing getFacingFromEntity(World worldIn, LocalPos clickedBlock, EntityLiving entityIn) { if (ExtMath.absf((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && ExtMath.absf((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F) { @@ -462,7 +462,7 @@ public class BlockPistonBase extends Block implements Directional return entityIn.getHorizontalFacing().getOpposite(); } - public static boolean canPush(Block blockIn, AWorldServer worldIn, BlockPos pos, Facing direction, boolean allowDestroy) + public static boolean canPush(Block blockIn, AWorldServer worldIn, LocalPos pos, Facing direction, boolean allowDestroy) { if (blockIn == Blocks.obsidian) { @@ -516,7 +516,7 @@ public class BlockPistonBase extends Block implements Directional } } - private boolean doMove(AWorldServer worldIn, BlockPos pos, Facing direction, boolean extending) + private boolean doMove(AWorldServer worldIn, LocalPos pos, Facing direction, boolean extending) { if (!extending) { @@ -524,8 +524,8 @@ public class BlockPistonBase extends Block implements Directional } BlockPistonStructureHelper blockpistonstructurehelper = new BlockPistonStructureHelper(worldIn, pos, direction, extending); - List list = blockpistonstructurehelper.getBlocksToMove(); - List list1 = blockpistonstructurehelper.getBlocksToDestroy(); + List list = blockpistonstructurehelper.getBlocksToMove(); + List list1 = blockpistonstructurehelper.getBlocksToDestroy(); if (!blockpistonstructurehelper.canMove()) { @@ -539,7 +539,7 @@ public class BlockPistonBase extends Block implements Directional for (int j = list1.size() - 1; j >= 0; --j) { - BlockPos blockpos = (BlockPos)list1.get(j); + LocalPos blockpos = (LocalPos)list1.get(j); Block block = worldIn.getState(blockpos).getBlock(); block.drop(worldIn, blockpos, worldIn.getState(blockpos), 0); worldIn.setBlockToAir(blockpos); @@ -549,7 +549,7 @@ public class BlockPistonBase extends Block implements Directional for (int k = list.size() - 1; k >= 0; --k) { - BlockPos blockpos2 = (BlockPos)list.get(k); + LocalPos blockpos2 = (LocalPos)list.get(k); State iblockstate = worldIn.getState(blockpos2); Block block1 = iblockstate.getBlock(); worldIn.setBlockToAir(blockpos2); @@ -559,7 +559,7 @@ public class BlockPistonBase extends Block implements Directional ablock[i] = block1; } - BlockPos blockpos1 = pos.offset(direction); + LocalPos blockpos1 = pos.offset(direction); if (extending) { @@ -569,12 +569,12 @@ public class BlockPistonBase extends Block implements Directional for (int l = list1.size() - 1; l >= 0; --l) { - worldIn.notifyNeighborsOfStateChange((BlockPos)list1.get(l), ablock[i++]); + worldIn.notifyNeighborsOfStateChange((LocalPos)list1.get(l), ablock[i++]); } for (int i1 = list.size() - 1; i1 >= 0; --i1) { - worldIn.notifyNeighborsOfStateChange((BlockPos)list.get(i1), ablock[i++]); + worldIn.notifyNeighborsOfStateChange((LocalPos)list.get(i1), ablock[i++]); } if (extending) @@ -587,7 +587,7 @@ public class BlockPistonBase extends Block implements Directional } } - private void launchWithSlimeBlock(AWorldServer world, BlockPos pos, Facing pistonFacing, boolean extending) + private void launchWithSlimeBlock(AWorldServer world, LocalPos pos, Facing pistonFacing, boolean extending) { float step = 0.25f; diff --git a/common/src/main/java/common/block/tech/BlockPistonHead.java b/common/src/main/java/common/block/tech/BlockPistonHead.java index ce2bcf8f..53a52daa 100755 --- a/common/src/main/java/common/block/tech/BlockPistonHead.java +++ b/common/src/main/java/common/block/tech/BlockPistonHead.java @@ -15,7 +15,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.properties.Property; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.world.IWorldAccess; @@ -36,7 +36,7 @@ public class BlockPistonHead extends Block implements Directional this.sticky = sticky; } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { super.onRemoved(worldIn, pos, state); Facing enumfacing = ((Facing)state.getValue(FACING)).getOpposite(); @@ -63,7 +63,7 @@ public class BlockPistonHead extends Block implements Directional return false; } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return false; } @@ -71,7 +71,7 @@ public class BlockPistonHead extends Block implements Directional /** * Check whether this Block can be placed on the given side */ - public boolean canPlace(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, LocalPos pos, Facing side) { return false; } @@ -87,7 +87,7 @@ public class BlockPistonHead extends Block implements Directional /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.applyHeadBounds(state); super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); @@ -131,7 +131,7 @@ public class BlockPistonHead extends Block implements Directional } } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { this.applyHeadBounds(worldIn.getState(pos)); } @@ -174,10 +174,10 @@ public class BlockPistonHead extends Block implements Directional /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { Facing enumfacing = (Facing)state.getValue(FACING); - BlockPos blockpos = pos.offset(enumfacing.getOpposite()); + LocalPos blockpos = pos.offset(enumfacing.getOpposite()); State iblockstate = worldIn.getState(blockpos); if (iblockstate.getBlock() != Blocks.piston && iblockstate.getBlock() != Blocks.sticky_piston) @@ -190,7 +190,7 @@ public class BlockPistonHead extends Block implements Directional } } - public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) { return true; } diff --git a/common/src/main/java/common/block/tech/BlockPressurePlate.java b/common/src/main/java/common/block/tech/BlockPressurePlate.java index 48b1d05e..5238e5ef 100755 --- a/common/src/main/java/common/block/tech/BlockPressurePlate.java +++ b/common/src/main/java/common/block/tech/BlockPressurePlate.java @@ -7,7 +7,7 @@ import common.entity.Entity; import common.entity.types.EntityLiving; import common.properties.Property; import common.properties.PropertyBool; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Serverside; import common.world.AWorldServer; @@ -27,7 +27,7 @@ public class BlockPressurePlate extends BlockBasePressurePlate } @Serverside - public double getResistance(AWorldServer worldIn, BlockPos pos, State state) { + public double getResistance(AWorldServer worldIn, LocalPos pos, State state) { return state.getValue(POWERED) ? 0.0 : super.getResistance(worldIn, pos, state); } @@ -41,7 +41,7 @@ public class BlockPressurePlate extends BlockBasePressurePlate return state.withProperty(POWERED, Boolean.valueOf(strength > 0)); } - protected int computeSignalStrength(World worldIn, BlockPos pos) + protected int computeSignalStrength(World worldIn, LocalPos pos) { BoundingBox axisalignedbb = this.getSensitiveAABB(pos); List list; diff --git a/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java b/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java index 8dc257e7..7741c0af 100755 --- a/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java +++ b/common/src/main/java/common/block/tech/BlockPressurePlateWeighted.java @@ -4,7 +4,7 @@ import common.block.Material; import common.entity.Entity; import common.properties.Property; import common.properties.PropertyInteger; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Serverside; import common.world.AWorldServer; @@ -23,7 +23,7 @@ public class BlockPressurePlateWeighted extends BlockBasePressurePlate this.field_150068_a = p_i46380_2_; } - protected int computeSignalStrength(World worldIn, BlockPos pos) + protected int computeSignalStrength(World worldIn, LocalPos pos) { int i = Math.min(worldIn.getEntitiesWithinAABB(Entity.class, this.getSensitiveAABB(pos)).size(), this.field_150068_a); @@ -39,7 +39,7 @@ public class BlockPressurePlateWeighted extends BlockBasePressurePlate } @Serverside - public double getResistance(AWorldServer worldIn, BlockPos pos, State state) { + public double getResistance(AWorldServer worldIn, LocalPos pos, State state) { return state.getValue(POWER) > 0 ? (double)(15 - state.getValue(POWER)) * 10000.0 : super.getResistance(worldIn, pos, state); } @@ -56,7 +56,7 @@ public class BlockPressurePlateWeighted extends BlockBasePressurePlate /** * How many world ticks before ticking */ - public int tickRate(World worldIn, BlockPos pos) + public int tickRate(World worldIn, LocalPos pos) { return 10; } diff --git a/common/src/main/java/common/block/tech/BlockRail.java b/common/src/main/java/common/block/tech/BlockRail.java index 0eb9a7b6..d3bc1f01 100755 --- a/common/src/main/java/common/block/tech/BlockRail.java +++ b/common/src/main/java/common/block/tech/BlockRail.java @@ -13,7 +13,7 @@ import common.model.ModelRotation; import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyEnum; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.DirectionVec; import common.util.Facing; @@ -29,7 +29,7 @@ public class BlockRail extends Block { public static final PropertyEnum SHAPE = PropertyEnum.create("shape", BlockRail.EnumRailDirection.class); - public static boolean isRailBlock(World worldIn, BlockPos pos) + public static boolean isRailBlock(World worldIn, LocalPos pos) { return isRailBlock(worldIn.getState(pos)); } @@ -48,7 +48,7 @@ public class BlockRail extends Block this.setDefaultState(this.getBaseState().withProperty(SHAPE, BlockRail.EnumRailDirection.NORTH_SOUTH)); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -64,13 +64,13 @@ public class BlockRail extends Block /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. */ - public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public HitPosition rayTrace(World worldIn, LocalPos pos, Vec3 start, Vec3 end) { this.setBlockBounds(worldIn, pos); return super.rayTrace(worldIn, pos, start, end); } - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos); BlockRail.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() == this ? (BlockRail.EnumRailDirection)iblockstate.getValue(SHAPE) : null; @@ -90,12 +90,12 @@ public class BlockRail extends Block return false; } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return worldIn.isBlockSolid(pos.down()); } - public void onAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, LocalPos pos, State state) { if (!worldIn.client) { @@ -106,7 +106,7 @@ public class BlockRail extends Block /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!worldIn.client) { @@ -147,7 +147,7 @@ public class BlockRail extends Block } } - protected State applyState(World worldIn, BlockPos pos, State state, boolean force) + protected State applyState(World worldIn, LocalPos pos, State state, boolean force) { return worldIn.client ? state : (new BlockRail.Rail(worldIn, pos, state)).setDirection(false /* TODO: switching */, force).getBlockState(); } @@ -157,7 +157,7 @@ public class BlockRail extends Block return 0; } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { super.onRemoved(worldIn, pos, state); @@ -213,7 +213,7 @@ public class BlockRail extends Block return GuiPosition.SMALL_FLAT; } - protected void onNeighborChangedInternal(World worldIn, BlockPos pos, State state, Block neighborBlock) + protected void onNeighborChangedInternal(World worldIn, LocalPos pos, State state, Block neighborBlock) { if ((new BlockRail.Rail(worldIn, pos, state)).countAdjacentRails() == 3) { @@ -290,12 +290,12 @@ public class BlockRail extends Block public class Rail { private final World world; - private final BlockPos pos; + private final LocalPos pos; private final BlockRail block; private State state; - private final List field_150657_g = Lists.newArrayList(); + private final List field_150657_g = Lists.newArrayList(); - public Rail(World worldIn, BlockPos pos, State state) + public Rail(World worldIn, LocalPos pos, State state) { this.world = worldIn; this.pos = pos; @@ -366,7 +366,7 @@ public class BlockRail extends Block { for (int i = 0; i < this.field_150657_g.size(); ++i) { - BlockRail.Rail blockrailbase$rail = this.findRailAt((BlockPos)this.field_150657_g.get(i)); + BlockRail.Rail blockrailbase$rail = this.findRailAt((LocalPos)this.field_150657_g.get(i)); if (blockrailbase$rail != null && blockrailbase$rail.func_150653_a(this)) { @@ -379,12 +379,12 @@ public class BlockRail extends Block } } - private boolean hasRailAt(BlockPos pos) + private boolean hasRailAt(LocalPos pos) { return BlockRail.isRailBlock(this.world, pos) || BlockRail.isRailBlock(this.world, pos.up()) || BlockRail.isRailBlock(this.world, pos.down()); } - private BlockRail.Rail findRailAt(BlockPos pos) + private BlockRail.Rail findRailAt(LocalPos pos) { State iblockstate = this.world.getState(pos); @@ -394,7 +394,7 @@ public class BlockRail extends Block } else { - BlockPos lvt_2_1_ = pos.up(); + LocalPos lvt_2_1_ = pos.up(); iblockstate = this.world.getState(lvt_2_1_); if (BlockRail.isRailBlock(iblockstate)) @@ -415,11 +415,11 @@ public class BlockRail extends Block return this.func_180363_c(p_150653_1_.pos); } - private boolean func_180363_c(BlockPos p_180363_1_) + private boolean func_180363_c(LocalPos p_180363_1_) { for (int i = 0; i < this.field_150657_g.size(); ++i) { - BlockPos blockpos = (BlockPos)this.field_150657_g.get(i); + LocalPos blockpos = (LocalPos)this.field_150657_g.get(i); if (blockpos.getX() == p_180363_1_.getX() && blockpos.getZ() == p_180363_1_.getZ()) { @@ -453,10 +453,10 @@ public class BlockRail extends Block private void func_150645_c(BlockRail.Rail p_150645_1_) { this.field_150657_g.add(p_150645_1_.pos); - BlockPos blockpos = this.pos.north(); - BlockPos blockpos1 = this.pos.south(); - BlockPos blockpos2 = this.pos.west(); - BlockPos blockpos3 = this.pos.east(); + LocalPos blockpos = this.pos.north(); + LocalPos blockpos1 = this.pos.south(); + LocalPos blockpos2 = this.pos.west(); + LocalPos blockpos3 = this.pos.east(); boolean flag = this.func_180363_c(blockpos); boolean flag1 = this.func_180363_c(blockpos1); boolean flag2 = this.func_180363_c(blockpos2); @@ -528,7 +528,7 @@ public class BlockRail extends Block this.world.setState(this.pos, this.state, 3); } - private boolean func_180361_d(BlockPos p_180361_1_) + private boolean func_180361_d(LocalPos p_180361_1_) { BlockRail.Rail blockrailbase$rail = this.findRailAt(p_180361_1_); @@ -545,10 +545,10 @@ public class BlockRail extends Block public BlockRail.Rail setDirection(boolean switched, boolean force) { - BlockPos blockpos = this.pos.north(); - BlockPos blockpos1 = this.pos.south(); - BlockPos blockpos2 = this.pos.west(); - BlockPos blockpos3 = this.pos.east(); + LocalPos blockpos = this.pos.north(); + LocalPos blockpos1 = this.pos.south(); + LocalPos blockpos2 = this.pos.west(); + LocalPos blockpos3 = this.pos.east(); boolean flag = this.func_180361_d(blockpos); boolean flag1 = this.func_180361_d(blockpos1); boolean flag2 = this.func_180361_d(blockpos2); @@ -683,7 +683,7 @@ public class BlockRail extends Block for (int i = 0; i < this.field_150657_g.size(); ++i) { - BlockRail.Rail blockrailbase$rail = this.findRailAt((BlockPos)this.field_150657_g.get(i)); + BlockRail.Rail blockrailbase$rail = this.findRailAt((LocalPos)this.field_150657_g.get(i)); if (blockrailbase$rail != null) { diff --git a/common/src/main/java/common/block/tech/BlockSign.java b/common/src/main/java/common/block/tech/BlockSign.java index 9467ebd8..da0ec545 100755 --- a/common/src/main/java/common/block/tech/BlockSign.java +++ b/common/src/main/java/common/block/tech/BlockSign.java @@ -11,7 +11,7 @@ import common.item.Item; import common.properties.Property; import common.tileentity.TileEntity; import common.tileentity.TileEntitySign; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.vars.Vars; @@ -31,7 +31,7 @@ public class BlockSign extends Block implements ITileEntityProvider, Rotatable this.setTab(CheatTab.DECORATION); } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (!worldIn.client && Vars.editSigns) { @@ -45,12 +45,12 @@ public class BlockSign extends Block implements ITileEntityProvider, Rotatable return true; } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } - public BoundingBox getSelectionBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, LocalPos pos) { this.setBlockBounds(worldIn, pos); return super.getSelectionBox(worldIn, pos); @@ -61,7 +61,7 @@ public class BlockSign extends Block implements ITileEntityProvider, Rotatable return false; } - public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + public boolean isPassable(IBlockAccess worldIn, LocalPos pos) { return true; } @@ -119,16 +119,16 @@ public class BlockSign extends Block implements ITileEntityProvider, Rotatable // super.onBlockRemoved(worldIn, pos, state); // } - private boolean isInvalidNeighbor(World world, BlockPos pos, Facing face) { + private boolean isInvalidNeighbor(World world, LocalPos pos, Facing face) { return world.getState(pos.offset(face)).getBlock().getMaterial() == Material.BLOCKING; } - private boolean hasInvalidNeighbor(World world, BlockPos pos) { + private boolean hasInvalidNeighbor(World world, LocalPos pos) { return this.isInvalidNeighbor(world, pos, Facing.NORTH) || this.isInvalidNeighbor(world, pos, Facing.SOUTH) || this.isInvalidNeighbor(world, pos, Facing.WEST) || this.isInvalidNeighbor(world, pos, Facing.EAST); } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { return !this.hasInvalidNeighbor(worldIn, pos) && super.canPlace(worldIn, pos); } diff --git a/common/src/main/java/common/block/tech/BlockStandingSign.java b/common/src/main/java/common/block/tech/BlockStandingSign.java index 8772219a..b1a58e24 100755 --- a/common/src/main/java/common/block/tech/BlockStandingSign.java +++ b/common/src/main/java/common/block/tech/BlockStandingSign.java @@ -10,7 +10,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.tileentity.TileEntity; import common.tileentity.TileEntitySign; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.Facing; import common.world.AWorldServer; @@ -20,7 +20,7 @@ import common.world.World; public class BlockStandingSign extends BlockSign implements Rotatable { - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); @@ -38,7 +38,7 @@ public class BlockStandingSign extends BlockSign implements Rotatable } } - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { if (!worldIn.getState(pos.down()).getBlock().getMaterial().isSolid()) { @@ -49,7 +49,7 @@ public class BlockStandingSign extends BlockSign implements Rotatable super.onUpdate(worldIn, pos, state, neighborBlock); } - public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (side == Facing.DOWN) { @@ -100,7 +100,7 @@ public class BlockStandingSign extends BlockSign implements Rotatable } @Clientside - public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) + public boolean checkPlace(World worldIn, LocalPos pos, Facing side, EntityNPC player, ItemStack stack) { return side != Facing.DOWN && worldIn.getState(pos).getBlock().getMaterial().isSolid(); } diff --git a/common/src/main/java/common/block/tech/BlockString.java b/common/src/main/java/common/block/tech/BlockString.java index 40c286b3..41cfb00c 100755 --- a/common/src/main/java/common/block/tech/BlockString.java +++ b/common/src/main/java/common/block/tech/BlockString.java @@ -13,7 +13,7 @@ import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.world.IBlockAccess; @@ -41,12 +41,12 @@ public class BlockString extends Block * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { return state.withProperty(NORTH, Boolean.valueOf(isConnectedTo(worldIn, pos, state, Facing.NORTH))).withProperty(EAST, Boolean.valueOf(isConnectedTo(worldIn, pos, state, Facing.EAST))).withProperty(SOUTH, Boolean.valueOf(isConnectedTo(worldIn, pos, state, Facing.SOUTH))).withProperty(WEST, Boolean.valueOf(isConnectedTo(worldIn, pos, state, Facing.WEST))); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -64,23 +64,23 @@ public class BlockString extends Block return false; } - public void onAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, LocalPos pos, State state) { this.notifyHook(worldIn, pos, state); } - public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, LocalPos pos, State state) { this.notifyHook(worldIn, pos, state.withProperty(TOUCHED, Boolean.valueOf(true))); } - private void notifyHook(AWorldServer worldIn, BlockPos pos, State state) + private void notifyHook(AWorldServer worldIn, LocalPos pos, State state) { for (Facing enumfacing : new Facing[] {Facing.SOUTH, Facing.WEST}) { for (int i = 1; i < 42; ++i) { - BlockPos blockpos = pos.offset(enumfacing, i); + LocalPos blockpos = pos.offset(enumfacing, i); State iblockstate = worldIn.getState(blockpos); if (iblockstate.getBlock() instanceof BlockHook hook) @@ -104,7 +104,7 @@ public class BlockString extends Block /** * Called When an Entity Collided with the Block */ - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { if (!worldIn.client) { @@ -115,7 +115,7 @@ public class BlockString extends Block } } - public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) { // if (!worldIn.client) // { @@ -126,7 +126,7 @@ public class BlockString extends Block // } } - private void updateState(AWorldServer worldIn, BlockPos pos) + private void updateState(AWorldServer worldIn, LocalPos pos) { State iblockstate = worldIn.getState(pos); boolean flag = ((Boolean)iblockstate.getValue(TOUCHED)).booleanValue(); @@ -158,9 +158,9 @@ public class BlockString extends Block } } - public static boolean isConnectedTo(IBlockAccess worldIn, BlockPos pos, State state, Facing direction) + public static boolean isConnectedTo(IBlockAccess worldIn, LocalPos pos, State state, Facing direction) { - BlockPos blockpos = pos.offset(direction); + LocalPos blockpos = pos.offset(direction); State iblockstate = worldIn.getState(blockpos); Block block = iblockstate.getBlock(); diff --git a/common/src/main/java/common/block/tech/BlockTNT.java b/common/src/main/java/common/block/tech/BlockTNT.java index 9de6b5e0..fae2d537 100755 --- a/common/src/main/java/common/block/tech/BlockTNT.java +++ b/common/src/main/java/common/block/tech/BlockTNT.java @@ -17,7 +17,7 @@ import common.model.Model.ModelProvider; import common.properties.Property; import common.properties.PropertyBool; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Facing; import common.util.Color; @@ -54,7 +54,7 @@ public class BlockTNT extends Block /** * Called when this Block is destroyed by an Explosion */ - public void onDestroyedExplosion(World worldIn, BlockPos pos, EntityLiving source, State prevState) + public void onDestroyedExplosion(World worldIn, LocalPos pos, EntityLiving source, State prevState) { if (!worldIn.client) { @@ -67,12 +67,12 @@ public class BlockTNT extends Block /** * Called when a player destroys this Block */ - public void onBroken(World worldIn, BlockPos pos, State state) + public void onBroken(World worldIn, LocalPos pos, State state) { this.explode(worldIn, pos, state, (EntityLiving)null); } - public void explode(World worldIn, BlockPos pos, State state, EntityLiving igniter) + public void explode(World worldIn, LocalPos pos, State state, EntityLiving igniter) { if (!worldIn.client) { @@ -85,7 +85,7 @@ public class BlockTNT extends Block } } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (playerIn.getHeldItem() != null) { @@ -115,7 +115,7 @@ public class BlockTNT extends Block /** * Called When an Entity Collided with the Block */ - public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn) { if (!worldIn.client && entityIn instanceof EntityArrow) { @@ -156,7 +156,7 @@ public class BlockTNT extends Block return new Property[] {EXPLODE}; } - public void onDestroyedFire(World world, BlockPos pos, State state) { + public void onDestroyedFire(World world, LocalPos pos, State state) { this.onBroken(world, pos, state.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true))); } @@ -168,7 +168,7 @@ public class BlockTNT extends Block return 1 + this.power; } - public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { blockpos = blockpos.offset(facing); EntityTnt entitytntprimed = new EntityTnt(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLiving)null, this.power); world.spawnEntityInWorld(entitytntprimed); diff --git a/common/src/main/java/common/block/tech/BlockToggleableLight.java b/common/src/main/java/common/block/tech/BlockToggleableLight.java index 39f12ffd..a9ba983a 100755 --- a/common/src/main/java/common/block/tech/BlockToggleableLight.java +++ b/common/src/main/java/common/block/tech/BlockToggleableLight.java @@ -6,7 +6,7 @@ import common.entity.npc.EntityNPC; import common.init.Blocks; import common.init.Items; import common.item.Item; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -21,11 +21,11 @@ public class BlockToggleableLight extends Block { this.setLight(0xffffcf); } - public void toggle(World worldIn, BlockPos pos) { + public void toggle(World worldIn, LocalPos pos) { worldIn.setState(pos, this.isOn ? Blocks.lamp.getState() : Blocks.lit_lamp.getState(), 2); } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { if(!this.isOn) { if(player.getHeldItem() == null) return super.onUse(worldIn, pos, state, player, side, hitX, hitY, hitZ); diff --git a/common/src/main/java/common/block/tech/BlockTorch.java b/common/src/main/java/common/block/tech/BlockTorch.java index de50a857..c0461143 100755 --- a/common/src/main/java/common/block/tech/BlockTorch.java +++ b/common/src/main/java/common/block/tech/BlockTorch.java @@ -14,7 +14,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.model.GuiPosition; import common.properties.Property; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.HitPosition; @@ -25,7 +25,7 @@ import common.world.AWorldServer; public abstract class BlockTorch extends Block implements Directional { - private static boolean isBlockNormalCube(World world, BlockPos pos, boolean def) { + private static boolean isBlockNormalCube(World world, LocalPos pos, boolean def) { if(!World.isValid(pos) || (world.client && !world.isBlockLoaded(pos, false))) return def; Block block = world.getState(pos).getBlock(); @@ -39,7 +39,7 @@ public abstract class BlockTorch extends Block implements Directional this.setTab(CheatTab.TECHNOLOGY); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -57,7 +57,7 @@ public abstract class BlockTorch extends Block implements Directional return false; } - private boolean canPlaceOn(World worldIn, BlockPos pos) + private boolean canPlaceOn(World worldIn, LocalPos pos) { if (worldIn.isBlockSolid(pos)) { @@ -70,7 +70,7 @@ public abstract class BlockTorch extends Block implements Directional } } - public boolean canPlace(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, LocalPos pos) { for (Facing enumfacing : Facing.values()) { @@ -83,9 +83,9 @@ public abstract class BlockTorch extends Block implements Directional return false; } - private boolean canPlaceAt(World worldIn, BlockPos pos, Facing facing) + private boolean canPlaceAt(World worldIn, LocalPos pos, Facing facing) { - BlockPos blockpos = pos.offset(facing.getOpposite()); + LocalPos blockpos = pos.offset(facing.getOpposite()); boolean flag = facing.getAxis().isHorizontal(); return flag && isBlockNormalCube(worldIn, blockpos, true) || facing.getAxis().isVertical() && this.canPlaceOn(worldIn, blockpos); } @@ -94,7 +94,7 @@ public abstract class BlockTorch extends Block implements Directional * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { if (this.canPlaceAt(worldIn, pos, facing)) { @@ -114,7 +114,7 @@ public abstract class BlockTorch extends Block implements Directional } } - public void onAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, LocalPos pos, State state) { this.checkForDrop(worldIn, pos, state); } @@ -122,12 +122,12 @@ public abstract class BlockTorch extends Block implements Directional /** * Called when a neighboring block changes. */ - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { this.onNeighborChangeInternal(worldIn, pos, state); } - protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, State state) + protected boolean onNeighborChangeInternal(World worldIn, LocalPos pos, State state) { if (!this.checkForDrop(worldIn, pos, state)) { @@ -162,7 +162,7 @@ public abstract class BlockTorch extends Block implements Directional } } - protected boolean checkForDrop(World worldIn, BlockPos pos, State state) + protected boolean checkForDrop(World worldIn, LocalPos pos, State state) { if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, state.getValue(FACING))) { @@ -183,7 +183,7 @@ public abstract class BlockTorch extends Block implements Directional /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. */ - public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public HitPosition rayTrace(World worldIn, LocalPos pos, Vec3 start, Vec3 end) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); float f = 0.15F; diff --git a/common/src/main/java/common/block/tech/BlockUnlitTorch.java b/common/src/main/java/common/block/tech/BlockUnlitTorch.java index e560e895..23b74bb1 100644 --- a/common/src/main/java/common/block/tech/BlockUnlitTorch.java +++ b/common/src/main/java/common/block/tech/BlockUnlitTorch.java @@ -4,7 +4,7 @@ import common.entity.npc.EntityNPC; import common.init.Items; import common.item.CheatTab; import common.item.Item; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -27,7 +27,7 @@ public class BlockUnlitTorch extends BlockTorch { return this.particleColor; } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(playerIn.getHeldItem() != null) { Item item = playerIn.getHeldItem().getItem(); diff --git a/common/src/main/java/common/block/tech/BlockWallSign.java b/common/src/main/java/common/block/tech/BlockWallSign.java index 34591581..c07fbc8c 100755 --- a/common/src/main/java/common/block/tech/BlockWallSign.java +++ b/common/src/main/java/common/block/tech/BlockWallSign.java @@ -5,7 +5,7 @@ import common.block.Rotatable; import common.model.Model; import common.model.Model.ModelProvider; import common.model.ModelRotation; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.AWorldServer; import common.world.IWorldAccess; @@ -13,7 +13,7 @@ import common.world.State; public class BlockWallSign extends BlockSign implements Rotatable { - public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); float f = 0.25f; @@ -42,7 +42,7 @@ public class BlockWallSign extends BlockSign implements Rotatable } } - public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) { Facing enumfacing = (Facing)state.getValue(FACING); diff --git a/common/src/main/java/common/block/tech/BlockWarpChest.java b/common/src/main/java/common/block/tech/BlockWarpChest.java index 35611a4f..772a5df3 100755 --- a/common/src/main/java/common/block/tech/BlockWarpChest.java +++ b/common/src/main/java/common/block/tech/BlockWarpChest.java @@ -15,7 +15,7 @@ import common.model.Model.ModelProvider; import common.model.ModelRotation; import common.properties.Property; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.ParticleType; import common.world.State; @@ -82,12 +82,12 @@ public class BlockWarpChest extends Block implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(!worldIn.client) { playerIn.getWarpChest().setPosition(pos); @@ -104,7 +104,7 @@ public class BlockWarpChest extends Block implements Rotatable // return new TileEntityWarpChest(); // } - public void displayTick(World worldIn, BlockPos pos, State state, Random rand) + public void displayTick(World worldIn, LocalPos pos, State state, Random rand) { for (int i = 0; i < 3; ++i) { diff --git a/common/src/main/java/common/block/tech/BlockWire.java b/common/src/main/java/common/block/tech/BlockWire.java index 490f0bed..1606397e 100755 --- a/common/src/main/java/common/block/tech/BlockWire.java +++ b/common/src/main/java/common/block/tech/BlockWire.java @@ -15,7 +15,7 @@ import common.model.GuiPosition; import common.properties.Property; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.Serverside; @@ -41,7 +41,7 @@ public class BlockWire extends Block this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); } - public State getState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, LocalPos pos) { state = state.withProperty(DOWN, this.canConnect(worldIn, pos, Facing.DOWN)); state = state.withProperty(UP, this.canConnect(worldIn, pos, Facing.UP)); @@ -52,12 +52,12 @@ public class BlockWire extends Block return state; } - private boolean canConnect(IBlockAccess worldIn, BlockPos pos, Facing direction) + private boolean canConnect(IBlockAccess worldIn, LocalPos pos, Facing direction) { return worldIn.getState(pos.offset(direction)).getBlock().canConnectToWire(this.getState()); } - public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state) { return null; } @@ -73,15 +73,15 @@ public class BlockWire extends Block } @Serverside - public double doPowerPhase(AWorldServer world, BlockPos pos, Random rand, double voltage, double currentLimit) { // TODO: implement - Queue queue = new ArrayDeque(); - Set traversed = Sets.newHashSet(); + public double doPowerPhase(AWorldServer world, LocalPos pos, Random rand, double voltage, double currentLimit) { // TODO: implement + Queue queue = new ArrayDeque(); + Set traversed = Sets.newHashSet(); traversed.add(pos); queue.add(pos); double converted = 0.0; while((pos = queue.poll()) != null) { for(Facing off : Facing.values()) { - BlockPos bpos = pos.offset(off); + LocalPos bpos = pos.offset(off); if(!traversed.contains(bpos)) { traversed.add(bpos); State state = world.getState(bpos); @@ -102,12 +102,12 @@ public class BlockWire extends Block } @Serverside - public double getResistance(AWorldServer worldIn, BlockPos pos, State state) { + public double getResistance(AWorldServer worldIn, LocalPos pos, State state) { return 5.0; } @Serverside - public double powerTick(AWorldServer worldIn, BlockPos pos, State state, Random rand, double voltage, double currentLimit) { + public double powerTick(AWorldServer worldIn, LocalPos pos, State state, Random rand, double voltage, double currentLimit) { return 0.01; } diff --git a/common/src/main/java/common/block/tech/BlockWorkbench.java b/common/src/main/java/common/block/tech/BlockWorkbench.java index a08b35d8..c6175b41 100755 --- a/common/src/main/java/common/block/tech/BlockWorkbench.java +++ b/common/src/main/java/common/block/tech/BlockWorkbench.java @@ -8,7 +8,7 @@ import common.inventory.ContainerWorkbench; import common.item.CheatTab; import common.model.Model; import common.model.Model.ModelProvider; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -28,7 +28,7 @@ public class BlockWorkbench extends Block return this.size; } - public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -49,9 +49,9 @@ public class BlockWorkbench extends Block public class Crafter implements InteractionObject { private final World world; - private final BlockPos position; + private final LocalPos position; - public Crafter(World worldIn, BlockPos pos) + public Crafter(World worldIn, LocalPos pos) { this.world = worldIn; this.position = pos; diff --git a/common/src/main/java/common/dimension/Dimension.java b/common/src/main/java/common/dimension/Dimension.java index 18411cdd..859b7b99 100755 --- a/common/src/main/java/common/dimension/Dimension.java +++ b/common/src/main/java/common/dimension/Dimension.java @@ -39,9 +39,9 @@ public abstract class Dimension extends Section { this.distChn = distChn; this.color = color; Vec3 vec = new Vec3(color); - this.rn = (float)vec.xCoord; - this.gn = (float)vec.yCoord; - this.bn = (float)vec.zCoord; + this.rn = (float)vec.x; + this.gn = (float)vec.y; + this.bn = (float)vec.z; } public int getColor(long time) { diff --git a/common/src/main/java/common/entity/DataWatcher.java b/common/src/main/java/common/entity/DataWatcher.java index 222676ae..c171509c 100755 --- a/common/src/main/java/common/entity/DataWatcher.java +++ b/common/src/main/java/common/entity/DataWatcher.java @@ -10,7 +10,7 @@ import common.collect.Lists; import common.collect.Maps; import common.item.ItemStack; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; public class DataWatcher { private static final Map, Integer> dataTypes = Maps., Integer>newHashMap(); @@ -206,7 +206,7 @@ public class DataWatcher { break; case 6: - BlockPos blockpos = (BlockPos)object.getObject(); + LocalPos blockpos = (LocalPos)object.getObject(); buffer.writeInt(blockpos.getX()); buffer.writeInt(blockpos.getY()); buffer.writeInt(blockpos.getZ()); @@ -261,7 +261,7 @@ public class DataWatcher { int l = buffer.readInt(); int i1 = buffer.readInt(); int j1 = buffer.readInt(); - datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, new BlockPos(l, i1, j1)); + datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, new LocalPos(l, i1, j1)); // break; // // case 7: @@ -309,7 +309,7 @@ public class DataWatcher { dataTypes.put(Float.class, Integer.valueOf(3)); dataTypes.put(String.class, Integer.valueOf(4)); dataTypes.put(ItemStack.class, Integer.valueOf(5)); - dataTypes.put(BlockPos.class, Integer.valueOf(6)); + dataTypes.put(LocalPos.class, Integer.valueOf(6)); // dataTypes.put(Rotations.class, Integer.valueOf(7)); } diff --git a/common/src/main/java/common/entity/Entity.java b/common/src/main/java/common/entity/Entity.java index a36cb1e0..5a7a66d5 100755 --- a/common/src/main/java/common/entity/Entity.java +++ b/common/src/main/java/common/entity/Entity.java @@ -27,12 +27,13 @@ import common.item.Item; import common.item.ItemStack; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.ExtMath; import common.util.Facing; import common.util.HitPosition; +import common.util.MutablePos; import common.util.ParticleType; import common.util.PortalType; import common.util.Position; @@ -369,7 +370,7 @@ public abstract class Entity // } else if(this.vehicle == null && this.passenger == null) { Entity ent = this.travelToDimension(dim, - new BlockPos(this.posX, (float)ExtMath.clampi(Vars.portalHeight, 0, 16384), this.posZ), + new LocalPos(this.posX, (float)ExtMath.clampi(Vars.portalHeight, 0, 16384), this.posZ), this.rotYaw, this.rotPitch, PortalType.VOID); ent.ignoreFall = true; } @@ -696,7 +697,7 @@ public abstract class Entity int i = ExtMath.floord(this.posX); int j = ExtMath.floord(this.posY - 0.20000000298023224D); int k = ExtMath.floord(this.posZ); - BlockPos blockpos = new BlockPos(i, j, k); + LocalPos blockpos = new LocalPos(i, j, k); Block block1 = this.worldObj.getState(blockpos).getBlock(); if (block1 == Blocks.air) @@ -816,8 +817,8 @@ public abstract class Entity protected void doBlockCollisions() { - BlockPos blockpos = new BlockPos(this.getEntityBoundingBox().minX + 0.001D, this.getEntityBoundingBox().minY + 0.001D, this.getEntityBoundingBox().minZ + 0.001D); - BlockPos blockpos1 = new BlockPos(this.getEntityBoundingBox().maxX - 0.001D, this.getEntityBoundingBox().maxY - 0.001D, this.getEntityBoundingBox().maxZ - 0.001D); + LocalPos blockpos = new LocalPos(this.getEntityBoundingBox().minX + 0.001D, this.getEntityBoundingBox().minY + 0.001D, this.getEntityBoundingBox().minZ + 0.001D); + LocalPos blockpos1 = new LocalPos(this.getEntityBoundingBox().maxX - 0.001D, this.getEntityBoundingBox().maxY - 0.001D, this.getEntityBoundingBox().maxZ - 0.001D); if (this.worldObj.isAreaLoaded(blockpos, blockpos1)) { @@ -827,7 +828,7 @@ public abstract class Entity { for (int k = blockpos.getZ(); k <= blockpos1.getZ(); ++k) { - BlockPos blockpos2 = new BlockPos(i, j, k); + LocalPos blockpos2 = new LocalPos(i, j, k); State iblockstate = this.worldObj.getState(blockpos2); iblockstate.getBlock().onCollideUpdate(this.worldObj, blockpos2, iblockstate, this); @@ -837,7 +838,7 @@ public abstract class Entity } } - protected void playStepSound(BlockPos pos, Block blockIn) + protected void playStepSound(LocalPos pos, Block blockIn) { SoundType block$soundtype = blockIn.getSound(); @@ -886,7 +887,7 @@ public abstract class Entity return true; } - protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, LocalPos pos) { if (onGroundIn) { @@ -949,12 +950,12 @@ public abstract class Entity */ public boolean isWet() { - return this.inLiquid || this.worldObj.isRainingAt(new BlockPos(this.posX, this.posY, this.posZ), true) || this.worldObj.isRainingAt(new BlockPos(this.posX, this.posY + (double)this.height, this.posZ), true); + return this.inLiquid || this.worldObj.isRainingAt(new LocalPos(this.posX, this.posY, this.posZ), true) || this.worldObj.isRainingAt(new LocalPos(this.posX, this.posY + (double)this.height, this.posZ), true); } public boolean isInDownfall() { - return this.worldObj.isRainingAt(new BlockPos(this.posX, this.posY, this.posZ), false) || this.worldObj.isRainingAt(new BlockPos(this.posX, this.posY + (double)this.height, this.posZ), false); + return this.worldObj.isRainingAt(new LocalPos(this.posX, this.posY, this.posZ), false) || this.worldObj.isRainingAt(new LocalPos(this.posX, this.posY + (double)this.height, this.posZ), false); } /** @@ -1009,7 +1010,7 @@ public abstract class Entity this.worldObj.clientParticle(ParticleType.SPLASH, this.posX + (double)f2, (double)(f1 + 1.0F), this.posZ + (double)f3); } - if(this.worldObj.getState(new BlockPos(this.posX, this.posY, this.posZ)).getBlock().getMaterial() == Material.WATER) { + if(this.worldObj.getState(new LocalPos(this.posX, this.posY, this.posZ)).getBlock().getMaterial() == Material.WATER) { for (int j = 0; (float)j < 1.0F + this.width * 20.0F; ++j) { float f4 = (this.rand.floatv() * 2.0F - 1.0F) * this.width; @@ -1035,7 +1036,7 @@ public abstract class Entity int i = ExtMath.floord(this.posX); int j = ExtMath.floord(this.posY - 0.20000000298023224D); int k = ExtMath.floord(this.posZ); - BlockPos blockpos = new BlockPos(i, j, k); + LocalPos blockpos = new LocalPos(i, j, k); State iblockstate = this.worldObj.getState(blockpos); Block block = iblockstate.getBlock(); @@ -1056,7 +1057,7 @@ public abstract class Entity public boolean isInsideOfLiquid() { double d0 = this.posY + (double)this.getEyeHeight(); - BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ); + LocalPos blockpos = new LocalPos(this.posX, d0, this.posZ); State iblockstate = this.worldObj.getState(blockpos); Block block = iblockstate.getBlock(); @@ -1138,7 +1139,7 @@ public abstract class Entity this.setRotation(yaw, pitch); } - public void moveToBlockPosAndAngles(BlockPos pos, float rotationYawIn, float rotationPitchIn) + public void moveToBlockPosAndAngles(LocalPos pos, float rotationYawIn, float rotationPitchIn) { this.setLocationAndAngles((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, rotationYawIn, rotationPitchIn); } @@ -1178,14 +1179,14 @@ public abstract class Entity return d0 * d0 + d1 * d1 + d2 * d2; } - public double getDistanceSq(BlockPos pos) + public double getDistanceSq(LocalPos pos) { return pos.distanceSq(this.posX, this.posY, this.posZ); } - public double getDistanceSqToCenter(BlockPos pos) + public double getDistanceSqToCenter(LocalPos pos) { - return pos.distanceSqToCenter(this.posX, this.posY, this.posZ); + return pos.distanceSqCenter(this.posX, this.posY, this.posZ); } /** @@ -1355,7 +1356,7 @@ public abstract class Entity { Vec3 vec3 = this.getPositionEyes(partialTicks); Vec3 vec31 = this.getLook(partialTicks); - Vec3 vec32 = vec3.addVector(vec31.xCoord * blockReachDistance, vec31.yCoord * blockReachDistance, vec31.zCoord * blockReachDistance); + Vec3 vec32 = vec3.add(vec31.x * blockReachDistance, vec31.y * blockReachDistance, vec31.z * blockReachDistance); return this.worldObj.rayTraceBlocks(vec3, vec32, liquid, false, true); } @@ -1631,7 +1632,7 @@ public abstract class Entity } else { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE); + MutablePos blockpos$mutableblockpos = new MutablePos(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE); for (int i = 0; i < 8; ++i) { @@ -1774,7 +1775,7 @@ public abstract class Entity this.unmount(); Entity entity = this; if(this.worldObj.dimension != dimension) { - entity = this.travelToDimension(dimension, new BlockPos(x, y, z), yaw, pitch, null); + entity = this.travelToDimension(dimension, new LocalPos(x, y, z), yaw, pitch, null); } entity.setLocationAndAngles(x, y, z, yaw, pitch); entity.setRotationYawHead(yaw); @@ -1794,11 +1795,11 @@ public abstract class Entity this.teleport(pos.x(), pos.y(), pos.z(), pos.yaw(), pos.pitch(), pos.getDimension()); } - public final void teleport(BlockPos pos, Dimension dim) { + public final void teleport(LocalPos pos, Dimension dim) { this.teleport(((double)pos.getX()) + 0.5, (double)pos.getY(), ((double)pos.getZ()) + 0.5, this.rotYaw, this.rotPitch, dim); } - public final void teleport(BlockPos pos, World world) { + public final void teleport(LocalPos pos, World world) { this.teleport(pos, world.dimension); } @@ -2045,7 +2046,7 @@ public abstract class Entity { } - private boolean isBlockFullCube(BlockPos pos) { + private boolean isBlockFullCube(LocalPos pos) { State state = this.worldObj.getState(pos); BoundingBox bb = state.getBlock().getCollisionBox(this.worldObj, pos, state); return bb != null && bb.getAverageEdgeLength() >= 1.0D; @@ -2053,7 +2054,7 @@ public abstract class Entity protected boolean pushOutOfBlocks(double x, double y, double z) { - BlockPos blockpos = new BlockPos(x, y, z); + LocalPos blockpos = new LocalPos(x, y, z); double d0 = x - (double)blockpos.getX(); double d1 = y - (double)blockpos.getY(); double d2 = z - (double)blockpos.getZ(); @@ -2208,7 +2209,7 @@ public abstract class Entity /** * Teleports the entity to another dimension. Params: Dimension number to teleport to */ - public Entity travelToDimension(Dimension dimensionId, BlockPos pos, float yaw, float pitch, PortalType portal) + public Entity travelToDimension(Dimension dimensionId, LocalPos pos, float yaw, float pitch, PortalType portal) { if (!this.worldObj.client && !this.dead) { @@ -2400,9 +2401,9 @@ public abstract class Entity * Get the position in the world. {@code null} is not allowed! If you are not an entity in the world, return * the coordinates 0, 0, 0 */ - public final BlockPos getPosition() + public final LocalPos getPosition() { - return new BlockPos(this.posX, this.posY + 0.5D, this.posZ); + return new LocalPos(this.posX, this.posY + 0.5D, this.posZ); } public TagObject getTag() diff --git a/common/src/main/java/common/entity/animal/EntityBat.java b/common/src/main/java/common/entity/animal/EntityBat.java index cb9ed0c5..39aab5e8 100755 --- a/common/src/main/java/common/entity/animal/EntityBat.java +++ b/common/src/main/java/common/entity/animal/EntityBat.java @@ -9,14 +9,14 @@ import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.init.SoundEvent; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.world.World; public class EntityBat extends EntityLiving { /** Coordinates of where the bat spawned. */ - private BlockPos spawnPosition; + private LocalPos spawnPosition; public EntityBat(World worldIn) { @@ -146,8 +146,8 @@ public class EntityBat extends EntityLiving protected void updateAITasks() { super.updateAITasks(); - BlockPos blockpos = new BlockPos(this); - BlockPos blockpos1 = blockpos.up(); + LocalPos blockpos = new LocalPos(this); + LocalPos blockpos1 = blockpos.up(); if (this.getIsBatHanging()) { @@ -179,7 +179,7 @@ public class EntityBat extends EntityLiving if (this.spawnPosition == null || this.rand.chance(30) || this.spawnPosition.distanceSq((double)((int)this.posX), (double)((int)this.posY), (double)((int)this.posZ)) < 4.0D) { - this.spawnPosition = new BlockPos((int)this.posX + this.rand.zrange(7) - this.rand.zrange(7), (int)this.posY + this.rand.range(-2, 3), (int)this.posZ + this.rand.zrange(7) - this.rand.zrange(7)); + this.spawnPosition = new LocalPos((int)this.posX + this.rand.zrange(7) - this.rand.zrange(7), (int)this.posY + this.rand.range(-2, 3), (int)this.posZ + this.rand.zrange(7) - this.rand.zrange(7)); } double d0 = (double)this.spawnPosition.getX() + 0.5D - this.posX; @@ -213,7 +213,7 @@ public class EntityBat extends EntityLiving { } - protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, LocalPos pos) { } @@ -262,7 +262,7 @@ public class EntityBat extends EntityLiving */ public boolean getCanSpawnHere() { - BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ); + LocalPos blockpos = new LocalPos(this.posX, this.getEntityBoundingBox().minY, this.posZ); if (blockpos.getY() >= this.worldObj.getSeaLevel()) { diff --git a/common/src/main/java/common/entity/animal/EntityDragon.java b/common/src/main/java/common/entity/animal/EntityDragon.java index c496e73a..c8054d81 100755 --- a/common/src/main/java/common/entity/animal/EntityDragon.java +++ b/common/src/main/java/common/entity/animal/EntityDragon.java @@ -19,7 +19,7 @@ import common.init.Items; import common.init.SoundEvent; import common.item.Item; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.world.World; @@ -121,7 +121,7 @@ public class EntityDragon extends EntityAnimal { { } - protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, LocalPos pos) { } diff --git a/common/src/main/java/common/entity/animal/EntityHorse.java b/common/src/main/java/common/entity/animal/EntityHorse.java index 8372eac4..940b9839 100755 --- a/common/src/main/java/common/entity/animal/EntityHorse.java +++ b/common/src/main/java/common/entity/animal/EntityHorse.java @@ -32,7 +32,7 @@ import common.item.spawner.ItemMobTemplate; import common.pathfinding.PathNavigateGround; import common.tags.TagObject; import java.util.List; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.util.ParticleType; @@ -395,7 +395,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic { } } - Block block = this.worldObj.getState(new BlockPos(this.posX, this.posY - 0.2D - (double)this.prevYaw, this.posZ)).getBlock(); + Block block = this.worldObj.getState(new LocalPos(this.posX, this.posY - 0.2D - (double)this.prevYaw, this.posZ)).getBlock(); if (block != Blocks.air) // && !this.isSilent()) { @@ -573,7 +573,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic { //// return "mob.horse.angry"; // } - protected void playStepSound(BlockPos pos, Block blockIn) + protected void playStepSound(LocalPos pos, Block blockIn) { SoundType block$soundtype = blockIn.getSound(); @@ -1025,7 +1025,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic { this.heal(1); } - if (!this.isEatingHaystack() && this.passenger == null && this.rand.chance(300) && this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.posY) - 1, ExtMath.floord(this.posZ))).getBlock() == Blocks.grass) + if (!this.isEatingHaystack() && this.passenger == null && this.rand.chance(300) && this.worldObj.getState(new LocalPos(ExtMath.floord(this.posX), ExtMath.floord(this.posY) - 1, ExtMath.floord(this.posZ))).getBlock() == Blocks.grass) { this.setEatingHaystack(true); } diff --git a/common/src/main/java/common/entity/animal/EntityMouse.java b/common/src/main/java/common/entity/animal/EntityMouse.java index a0747625..412fe425 100755 --- a/common/src/main/java/common/entity/animal/EntityMouse.java +++ b/common/src/main/java/common/entity/animal/EntityMouse.java @@ -18,7 +18,7 @@ import common.init.Blocks; import common.init.Items; import common.init.SoundEvent; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class EntityMouse extends EntityAnimal { @@ -59,7 +59,7 @@ public class EntityMouse extends EntityAnimal { return SoundEvent.RABBIT_HIT; } - protected void playStepSound(BlockPos pos, Block block) { + protected void playStepSound(LocalPos pos, Block block) { } protected float getSoundVolume() { @@ -97,7 +97,7 @@ public class EntityMouse extends EntityAnimal { return y < this.worldObj.getSeaLevel(); } - public float getBlockPathWeight(BlockPos pos) + public float getBlockPathWeight(LocalPos pos) { return 0.5F; } diff --git a/common/src/main/java/common/entity/animal/EntityRabbit.java b/common/src/main/java/common/entity/animal/EntityRabbit.java index d3fd9400..f36e76fd 100755 --- a/common/src/main/java/common/entity/animal/EntityRabbit.java +++ b/common/src/main/java/common/entity/animal/EntityRabbit.java @@ -34,7 +34,7 @@ import common.item.ItemStack; import common.pathfinding.PathEntity; import common.pathfinding.PathNavigateGround; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.util.Vec3; @@ -161,7 +161,7 @@ public class EntityRabbit extends EntityAnimal { if(pathentity != null && pathentity.getCurrentPathIndex() < pathentity.getCurrentPathLength()) { vec3 = pathentity.getPosition(this); } - this.calculateRotationYaw(vec3.xCoord, vec3.zCoord); + this.calculateRotationYaw(vec3.x, vec3.z); this.doMovementAction(this.moveType); } } @@ -329,7 +329,7 @@ public class EntityRabbit extends EntityAnimal { return this.moveType.getDuration(); } - protected void consumeBlock(BlockPos pos, State state) { + protected void consumeBlock(LocalPos pos, State state) { this.worldObj.playEffect(2001, pos, BlockRegistry.getId(state)); this.foodCooldown = this.rand.excl(10, this.isChild() ? 20 : 50); if(this.isChild()) @@ -450,7 +450,7 @@ public class EntityRabbit extends EntityAnimal { (double)this.destinationBlock.getZ() + 0.5D, 10.0F, (float)this.entity.getVerticalFaceSpeed()); if(this.getIsAboveDestination()) { World world = this.entity.worldObj; - BlockPos pos = Vars.rabidRabbits ? this.destinationBlock : this.destinationBlock.up(); + LocalPos pos = Vars.rabidRabbits ? this.destinationBlock : this.destinationBlock.up(); State state = world.getState(pos); // Block block = iblockstate.getBlock(); if(this.foodFound && canEat(state) && Vars.mobGrief) // block instanceof BlockCarrot && ((Integer)iblockstate.getValue(BlockCarrot.AGE)).intValue() == 7) { @@ -460,7 +460,7 @@ public class EntityRabbit extends EntityAnimal { } } - protected boolean shouldMoveTo(World worldIn, BlockPos pos) { + protected boolean shouldMoveTo(World worldIn, LocalPos pos) { // Block block = worldIn.getBlockState(pos).getBlock(); // if(block == Blocks.farmland) { pos = pos.up(); diff --git a/common/src/main/java/common/entity/effect/EntityLightning.java b/common/src/main/java/common/entity/effect/EntityLightning.java index 04d51878..7458fb06 100755 --- a/common/src/main/java/common/entity/effect/EntityLightning.java +++ b/common/src/main/java/common/entity/effect/EntityLightning.java @@ -7,7 +7,7 @@ import common.entity.types.EntityLiving; import common.entity.types.EntityWeatherEffect; import common.init.Blocks; import common.init.SoundEvent; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.vars.Vars; import common.world.World; @@ -62,7 +62,7 @@ public class EntityLightning extends EntityWeatherEffect --this.boltLivingTime; this.lightningState = 1; this.boltVertex = this.rand.longv(); - BlockPos blockpos = new BlockPos(this); + LocalPos blockpos = new LocalPos(this); if (!this.worldObj.client && this.fire && Vars.fire && this.worldObj.isAreaLoaded(blockpos, 10) && this.worldObj.getState(blockpos).getBlock() == Blocks.air && Blocks.fire.canPlace(this.worldObj, blockpos)) { diff --git a/common/src/main/java/common/entity/item/EntityBoat.java b/common/src/main/java/common/entity/item/EntityBoat.java index 8a8d8264..214fcb7c 100755 --- a/common/src/main/java/common/entity/item/EntityBoat.java +++ b/common/src/main/java/common/entity/item/EntityBoat.java @@ -13,7 +13,7 @@ import common.init.Blocks; import common.init.Items; import common.item.Item; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.ParticleType; @@ -385,7 +385,7 @@ public class EntityBoat extends Entity for (int j2 = 0; j2 < 2; ++j2) { int l = ExtMath.floord(this.posY) + j2; - BlockPos blockpos = new BlockPos(l1, l, i2); + LocalPos blockpos = new LocalPos(l1, l, i2); Block block = this.worldObj.getState(blockpos).getBlock(); if (block == Blocks.snow_layer) @@ -525,7 +525,7 @@ public class EntityBoat extends Entity } } - protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, LocalPos pos) { if (onGroundIn) { @@ -559,7 +559,7 @@ public class EntityBoat extends Entity this.fallDistance = 0.0F; } } - else if (!this.worldObj.getState((new BlockPos(this)).down()).getBlock().getMaterial().isColdLiquid() && y < 0.0D) + else if (!this.worldObj.getState((new LocalPos(this)).down()).getBlock().getMaterial().isColdLiquid() && y < 0.0D) { this.fallDistance = (float)((double)this.fallDistance - y); } diff --git a/common/src/main/java/common/entity/item/EntityCart.java b/common/src/main/java/common/entity/item/EntityCart.java index 37c1971a..d7801727 100755 --- a/common/src/main/java/common/entity/item/EntityCart.java +++ b/common/src/main/java/common/entity/item/EntityCart.java @@ -8,7 +8,7 @@ import common.init.Blocks; import common.init.Items; import common.item.ItemStack; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.Vec3; @@ -239,12 +239,12 @@ public abstract class EntityCart extends Entity int l = ExtMath.floord(this.posY); int i1 = ExtMath.floord(this.posZ); - if (BlockRail.isRailBlock(this.worldObj, new BlockPos(k, l - 1, i1))) + if (BlockRail.isRailBlock(this.worldObj, new LocalPos(k, l - 1, i1))) { --l; } - BlockPos blockpos = new BlockPos(k, l, i1); + LocalPos blockpos = new LocalPos(k, l, i1); State iblockstate = this.worldObj.getState(blockpos); if (BlockRail.isRailBlock(iblockstate)) @@ -350,7 +350,7 @@ public abstract class EntityCart extends Entity } - protected void moveRailedCart(BlockPos pos, State state) + protected void moveRailedCart(LocalPos pos, State state) { this.fallDistance = 0.0F; Vec3 vec3 = this.func_70489_a(this.posX, this.posY, this.posZ); @@ -505,7 +505,7 @@ public abstract class EntityCart extends Entity if (vec31 != null && vec3 != null) { - double d14 = (vec3.yCoord - vec31.yCoord) * 0.05D; + double d14 = (vec3.y - vec31.y) * 0.05D; d5 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); if (d5 > 0.0D) @@ -514,7 +514,7 @@ public abstract class EntityCart extends Entity this.motionZ = this.motionZ / d5 * (d5 + d14); } - this.setPosition(this.posX, vec31.yCoord, this.posZ); + this.setPosition(this.posX, vec31.y, this.posZ); } int j = ExtMath.floord(this.posX); @@ -597,12 +597,12 @@ public abstract class EntityCart extends Entity int j = ExtMath.floord(p_70495_3_); int k = ExtMath.floord(p_70495_5_); - if (BlockRail.isRailBlock(this.worldObj, new BlockPos(i, j - 1, k))) + if (BlockRail.isRailBlock(this.worldObj, new LocalPos(i, j - 1, k))) { --j; } - State iblockstate = this.worldObj.getState(new BlockPos(i, j, k)); + State iblockstate = this.worldObj.getState(new LocalPos(i, j, k)); if (BlockRail.isRailBlock(iblockstate)) { @@ -646,12 +646,12 @@ public abstract class EntityCart extends Entity int j = ExtMath.floord(p_70489_3_); int k = ExtMath.floord(p_70489_5_); - if (BlockRail.isRailBlock(this.worldObj, new BlockPos(i, j - 1, k))) + if (BlockRail.isRailBlock(this.worldObj, new LocalPos(i, j - 1, k))) { --j; } - State iblockstate = this.worldObj.getState(new BlockPos(i, j, k)); + State iblockstate = this.worldObj.getState(new LocalPos(i, j, k)); if (BlockRail.isRailBlock(iblockstate)) { @@ -762,7 +762,7 @@ public abstract class EntityCart extends Entity double d5 = entityIn.posZ - this.posZ; Vec3 vec3 = (new Vec3(d4, 0.0D, d5)).normalize(); Vec3 vec31 = (new Vec3((double)ExtMath.cos(this.rotYaw * (float)Math.PI / 180.0F), 0.0D, (double)ExtMath.sin(this.rotYaw * (float)Math.PI / 180.0F))).normalize(); - double d6 = Math.abs(vec3.dotProduct(vec31)); + double d6 = Math.abs(vec3.dot(vec31)); if (d6 < 0.800000011920929D) { diff --git a/common/src/main/java/common/entity/item/EntityFalling.java b/common/src/main/java/common/entity/item/EntityFalling.java index 5cabd0a7..c7a735e6 100755 --- a/common/src/main/java/common/entity/item/EntityFalling.java +++ b/common/src/main/java/common/entity/item/EntityFalling.java @@ -14,7 +14,7 @@ import common.init.BlockRegistry; import common.init.Blocks; import common.item.ItemStack; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Facing; import common.vars.Vars; @@ -96,7 +96,7 @@ public class EntityFalling extends Entity implements IObjectData if (this.fallTime++ == 0) { - BlockPos blockpos = new BlockPos(this); + LocalPos blockpos = new LocalPos(this); if (this.worldObj.getState(blockpos).getBlock() == block) { @@ -117,7 +117,7 @@ public class EntityFalling extends Entity implements IObjectData if (!this.worldObj.client) { - BlockPos blockpos1 = new BlockPos(this); + LocalPos blockpos1 = new LocalPos(this); if (this.onGround) { diff --git a/common/src/main/java/common/entity/item/EntityItem.java b/common/src/main/java/common/entity/item/EntityItem.java index 6235224d..221e4b23 100755 --- a/common/src/main/java/common/entity/item/EntityItem.java +++ b/common/src/main/java/common/entity/item/EntityItem.java @@ -14,7 +14,7 @@ import common.item.Item; import common.item.ItemStack; import common.log.Log; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.ParticleType; import common.util.PortalType; @@ -128,7 +128,7 @@ public class EntityItem extends Entity if (flag || this.ticksExisted % 25 == 0) { - if (this.worldObj.getState(new BlockPos(this)).getBlock().getMaterial() == Material.LAVA) + if (this.worldObj.getState(new LocalPos(this)).getBlock().getMaterial() == Material.LAVA) { this.motionY = 0.20000000298023224D; this.motionX = (double)((this.rand.floatv() - this.rand.floatv()) * 0.2F); @@ -153,7 +153,7 @@ public class EntityItem extends Entity if (this.onGround) { - f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.98F; + f = this.worldObj.getState(new LocalPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.98F; } this.motionX *= (double)f; @@ -462,7 +462,7 @@ public class EntityItem extends Entity /** * Teleports the entity to another dimension. Params: Dimension number to teleport to */ - public Entity travelToDimension(Dimension dimensionId, BlockPos pos, float yaw, float pitch, PortalType portal) + public Entity travelToDimension(Dimension dimensionId, LocalPos pos, float yaw, float pitch, PortalType portal) { Entity entity = super.travelToDimension(dimensionId, pos, yaw, pitch, portal); diff --git a/common/src/main/java/common/entity/item/EntityLeashKnot.java b/common/src/main/java/common/entity/item/EntityLeashKnot.java index c53e51e5..5aea3e65 100755 --- a/common/src/main/java/common/entity/item/EntityLeashKnot.java +++ b/common/src/main/java/common/entity/item/EntityLeashKnot.java @@ -10,7 +10,7 @@ import common.init.Items; import common.item.Item; import common.item.ItemStack; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.world.World; @@ -18,7 +18,7 @@ import common.world.World; public class EntityLeashKnot extends Entity { private int checkTimer; - private BlockPos fencePos; + private LocalPos fencePos; // /** The direction the entity is facing */ // public Facing facingDirection; @@ -29,7 +29,7 @@ public class EntityLeashKnot extends Entity this.setSize(0.5F, 0.5F); } - public EntityLeashKnot(World worldIn, BlockPos fence) + public EntityLeashKnot(World worldIn, LocalPos fence) { super(worldIn); this.fencePos = fence; @@ -42,7 +42,7 @@ public class EntityLeashKnot extends Entity public EntityLeashKnot(World worldIn, double x, double y, double z) { - this(worldIn, new BlockPos(ExtMath.floord(x), ExtMath.floord(y), ExtMath.floord(z))); + this(worldIn, new LocalPos(ExtMath.floord(x), ExtMath.floord(y), ExtMath.floord(z))); } protected void entityInit() @@ -213,8 +213,8 @@ public class EntityLeashKnot extends Entity this.posX = x; this.posY = y; this.posZ = z; - BlockPos blockpos = this.fencePos; - this.fencePos = new BlockPos(x, y, z); + LocalPos blockpos = this.fencePos; + this.fencePos = new LocalPos(x, y, z); if (!this.fencePos.equals(blockpos)) { @@ -223,7 +223,7 @@ public class EntityLeashKnot extends Entity } } - public BlockPos getHangingPosition() + public LocalPos getHangingPosition() { return this.fencePos; } @@ -340,7 +340,7 @@ public class EntityLeashKnot extends Entity return EntityType.OBJECT; } - public static EntityLeashKnot createKnot(World worldIn, BlockPos fence) + public static EntityLeashKnot createKnot(World worldIn, LocalPos fence) { EntityLeashKnot entityleashknot = new EntityLeashKnot(worldIn, fence); entityleashknot.forceSpawn = true; @@ -348,7 +348,7 @@ public class EntityLeashKnot extends Entity return entityleashknot; } - public static EntityLeashKnot getKnotForPosition(World worldIn, BlockPos pos) + public static EntityLeashKnot getKnotForPosition(World worldIn, LocalPos pos) { int i = pos.getX(); int j = pos.getY(); diff --git a/common/src/main/java/common/entity/item/EntityXp.java b/common/src/main/java/common/entity/item/EntityXp.java index 478f66aa..2bef9978 100755 --- a/common/src/main/java/common/entity/item/EntityXp.java +++ b/common/src/main/java/common/entity/item/EntityXp.java @@ -9,7 +9,7 @@ import common.entity.npc.EntityNPC; import common.entity.types.IObjectData; import common.init.SoundEvent; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.util.ParticleType; @@ -102,7 +102,7 @@ public class EntityXp extends Entity implements IObjectData this.prevZ = this.posZ; this.motionY -= 0.029999999329447746D; - if (this.worldObj.getState(new BlockPos(this)).getBlock().getMaterial() == Material.LAVA) + if (this.worldObj.getState(new LocalPos(this)).getBlock().getMaterial() == Material.LAVA) { this.motionY = 0.20000000298023224D; this.motionX = (double)((this.rand.floatv() - this.rand.floatv()) * 0.2F); @@ -171,7 +171,7 @@ public class EntityXp extends Entity implements IObjectData if (this.onGround) { - f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.98F; + f = this.worldObj.getState(new LocalPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.98F; } this.motionX *= (double)f; @@ -192,7 +192,7 @@ public class EntityXp extends Entity implements IObjectData } } - public Entity travelToDimension(Dimension dimensionId, BlockPos pos, float yaw, float pitch, PortalType portal) + public Entity travelToDimension(Dimension dimensionId, LocalPos pos, float yaw, float pitch, PortalType portal) { Entity entity = super.travelToDimension(dimensionId, pos, yaw, pitch, portal); diff --git a/common/src/main/java/common/entity/npc/EntityArachnoid.java b/common/src/main/java/common/entity/npc/EntityArachnoid.java index 2774acf7..864a3d3b 100755 --- a/common/src/main/java/common/entity/npc/EntityArachnoid.java +++ b/common/src/main/java/common/entity/npc/EntityArachnoid.java @@ -9,7 +9,6 @@ import common.entity.types.EntityLiving; import common.pathfinding.PathNavigate; import common.pathfinding.PathNavigateClimber; import common.rng.Random; -import common.util.BlockPos; import common.util.Equipment; import common.world.World; diff --git a/common/src/main/java/common/entity/npc/EntityCultivator.java b/common/src/main/java/common/entity/npc/EntityCultivator.java index a0d70fd7..865686c7 100755 --- a/common/src/main/java/common/entity/npc/EntityCultivator.java +++ b/common/src/main/java/common/entity/npc/EntityCultivator.java @@ -7,7 +7,7 @@ import common.entity.effect.EntityLightning; import common.init.Items; import common.item.ItemStack; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class EntityCultivator extends EntityNPC { @@ -32,7 +32,7 @@ public class EntityCultivator extends EntityNPC { if(EntityCultivator.this.rand.chance(100) && EntityCultivator.this.getHeldItem() != null && EntityCultivator.this.getHeldItem().getItem() == Items.camera) { EntityCultivator.this.swingItem(); - EntityCultivator.this.worldObj.playEffect(1024, new BlockPos(EntityCultivator.this.posX, + EntityCultivator.this.worldObj.playEffect(1024, new LocalPos(EntityCultivator.this.posX, EntityCultivator.this.posY + EntityCultivator.this.getEyeHeight(), EntityCultivator.this.posZ), 0); } } diff --git a/common/src/main/java/common/entity/npc/EntityFlyingNPC.java b/common/src/main/java/common/entity/npc/EntityFlyingNPC.java index bfcd959e..9da0e41f 100755 --- a/common/src/main/java/common/entity/npc/EntityFlyingNPC.java +++ b/common/src/main/java/common/entity/npc/EntityFlyingNPC.java @@ -6,7 +6,7 @@ import common.block.Block; import common.effect.Effect; import common.entity.types.EntityLiving; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.world.World; @@ -41,7 +41,7 @@ public abstract class EntityFlyingNPC extends EntityNPC { } - protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, LocalPos pos) { } diff --git a/common/src/main/java/common/entity/npc/EntityHuman.java b/common/src/main/java/common/entity/npc/EntityHuman.java index 64c03d4e..d59ac16e 100755 --- a/common/src/main/java/common/entity/npc/EntityHuman.java +++ b/common/src/main/java/common/entity/npc/EntityHuman.java @@ -4,7 +4,7 @@ import common.entity.types.EntityLiving; import common.init.Items; import common.item.ItemStack; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Identifyable; import common.village.Village; import common.world.World; @@ -110,7 +110,7 @@ public class EntityHuman extends EntityNPC { protected void updateAITasks() { if(--this.checkTimer <= 0) { - BlockPos blockpos = new BlockPos(this); + LocalPos blockpos = new LocalPos(this); // if(((IWorldServer)this.worldObj).isPrimary()) ((AWorldServer)this.worldObj).addToVillagerPositionList(blockpos); this.checkTimer = this.rand.excl(70, 120); @@ -120,7 +120,7 @@ public class EntityHuman extends EntityNPC { this.detachHome(); } else { - BlockPos blockpos1 = this.village.getCenter(); + LocalPos blockpos1 = this.village.getCenter(); this.setHomePosAndDistance(blockpos1, (int)((float)this.village.getRadius() * 1.0F)); } } diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index 69e1045a..22e83116 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -81,7 +81,7 @@ import common.pathfinding.PathNavigateGround; import common.rng.Random; import common.sound.MovingSoundMinecartRiding; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.ExtMath; @@ -91,7 +91,7 @@ import common.util.ParticleType; import common.util.PortalType; import common.util.Color; import common.util.Vec3; -import common.util.WorldPos; +import common.util.GlobalPos; import common.vars.Vars; import common.village.MerchantRecipeList; import common.world.World; @@ -232,8 +232,8 @@ public abstract class EntityNPC extends EntityLiving implements IInventory public double chasingPosX; public double chasingPosY; public double chasingPosZ; - private WorldPos originPos = new WorldPos(0, 64, 0, Space.INSTANCE); - private WorldPos spawnPos; + private GlobalPos originPos = new GlobalPos(0, 64, 0, Space.INSTANCE); + private GlobalPos spawnPos; public int experienceLevel; public int experienceTotal; public float experience; @@ -1229,9 +1229,9 @@ public abstract class EntityNPC extends EntityLiving implements IInventory this.posZ - entity.posZ); vec3 = vec3.normalize(); double dist = 16.0D; - double x = this.posX + (this.rand.doublev() - 0.5D) * 8.0D - vec3.xCoord * dist; - double y = this.posY + (double)(this.rand.excl(-8, 8)) - vec3.yCoord * dist; - double z = this.posZ + (this.rand.doublev() - 0.5D) * 8.0D - vec3.zCoord * dist; + double x = this.posX + (this.rand.doublev() - 0.5D) * 8.0D - vec3.x * dist; + double y = this.posY + (double)(this.rand.excl(-8, 8)) - vec3.y * dist; + double z = this.posZ + (this.rand.doublev() - 0.5D) * 8.0D - vec3.z * dist; return this.teleportTo(x, y, z); } @@ -1243,13 +1243,13 @@ public abstract class EntityNPC extends EntityLiving implements IInventory this.posY = y; this.posZ = z; boolean done = false; - BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ); + LocalPos pos = new LocalPos(this.posX, this.posY, this.posZ); if(this.worldObj.isBlockLoaded(pos)) { boolean ground = false; while(!ground && pos.getY() > 0) { - BlockPos down = pos.down(); + LocalPos down = pos.down(); Block block = this.worldObj.getState(down).getBlock(); if(block.getMaterial().blocksMovement()) { @@ -1276,7 +1276,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory return false; } else { - this.worldObj.playEffect(1013, new BlockPos(ox, oy, oz), 0); + this.worldObj.playEffect(1013, new LocalPos(ox, oy, oz), 0); for(int n = 0; n < 8; n++) { ((AWorldServer)this.worldObj).spawnParticles(ParticleType.TELEPORT, ox + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D, @@ -1559,7 +1559,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory public void onUpdate() { if(this.client != null) { - if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ))) + if (this.worldObj.isBlockLoaded(new LocalPos(this.posX, 0.0D, this.posZ))) { // super.onUpdate(); this.updatePlayer(); @@ -1743,7 +1743,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory { if(this.client != null) { CPacketBreak.Action c07packetplayerdigging$action = dropAll ? CPacketBreak.Action.DROP_ALL_ITEMS : CPacketBreak.Action.DROP_ITEM; - this.client.addToSendQueue(new CPacketBreak(c07packetplayerdigging$action, BlockPos.ORIGIN, Facing.DOWN)); + this.client.addToSendQueue(new CPacketBreak(c07packetplayerdigging$action, LocalPos.ORIGIN, Facing.DOWN)); return null; } return this.dropItem(this.decrStackSize(this.getSelectedIndex(), dropAll && this.getHeldItem() != null ? this.getHeldItem().getSize() : 1), false, true); @@ -1819,7 +1819,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory } else { - BlockPos blockpos = new BlockPos(x, y, z); + LocalPos blockpos = new LocalPos(x, y, z); double d0 = x - (double)blockpos.getX(); double d1 = z - (double)blockpos.getZ(); @@ -2440,7 +2440,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory /** * Returns true if the block at the given BlockPos and the block above it are NOT full cubes. */ - private boolean isOpenBlockSpace(BlockPos pos) + private boolean isOpenBlockSpace(LocalPos pos) { return !this.worldObj.getState(pos).getBlock().isNormalCube() && (this.height <= 1.0f || !this.worldObj.getState(pos.up()).getBlock().isNormalCube()); } @@ -2826,7 +2826,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory } } - public Entity travelToDimension(Dimension dimensionId, BlockPos pos, float yaw, float pitch, PortalType portal) { + public Entity travelToDimension(Dimension dimensionId, LocalPos pos, float yaw, float pitch, PortalType portal) { if(this.connection != null) this.connection.travelToDimension(dimensionId, pos, yaw, pitch, portal); return this.isPlayer() ? this : super.travelToDimension(dimensionId, pos, yaw, pitch, portal); @@ -2845,7 +2845,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory this.connection.onItemPickup(entity, amount); } - protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) { + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, LocalPos pos) { if(this.connection == null) super.updateFallState(y, onGroundIn, blockIn, pos); } @@ -2925,7 +2925,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory this.updatePlayer(); } - public void updateEntityFall(double y, boolean onGroundIn, Block blockIn, BlockPos pos) { + public void updateEntityFall(double y, boolean onGroundIn, Block blockIn, LocalPos pos) { super.updateFallState(y, onGroundIn, blockIn, pos); } @@ -3374,7 +3374,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory if (tag.hasInt("SpawnX") && tag.hasInt("SpawnY") && tag.hasInt("SpawnZ") && tag.hasString("SpawnDim")) { Dimension dim = DimensionRegistry.getDimension(tag.getString("SpawnDim")); - this.spawnPos = dim == null ? null : new WorldPos(tag.getInt("SpawnX"), tag.getInt("SpawnY"), + this.spawnPos = dim == null ? null : new GlobalPos(tag.getInt("SpawnX"), tag.getInt("SpawnY"), tag.getInt("SpawnZ"), dim); // this.spawnForced = tagCompund.getBoolean("SpawnForced"); } @@ -3382,7 +3382,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory if (tag.hasInt("OriginX") && tag.hasInt("OriginY") && tag.hasInt("OriginZ") && tag.hasString("OriginDim")) { Dimension dim = DimensionRegistry.getDimension(tag.getString("OriginDim")); - this.originPos = dim == null ? new WorldPos(0, 64, 0, Space.INSTANCE) : new WorldPos(tag.getInt("OriginX"), tag.getInt("OriginY"), + this.originPos = dim == null ? new GlobalPos(0, 64, 0, Space.INSTANCE) : new GlobalPos(tag.getInt("OriginX"), tag.getInt("OriginY"), tag.getInt("OriginZ"), dim); } @@ -3743,7 +3743,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory /** * Return null if bed is invalid */ - public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation) + public static LocalPos getBedSpawnLocation(World worldIn, LocalPos bedLocation) { Block block = worldIn.getState(bedLocation).getBlock(); @@ -3757,22 +3757,22 @@ public abstract class EntityNPC extends EntityLiving implements IInventory } } - public WorldPos getSpawnPoint() + public GlobalPos getSpawnPoint() { return this.spawnPos; } - public void setSpawnPoint(WorldPos pos) + public void setSpawnPoint(GlobalPos pos) { this.spawnPos = pos; } - public WorldPos getOrigin() + public GlobalPos getOrigin() { return this.originPos; } - public void setOrigin(WorldPos pos) + public void setOrigin(GlobalPos pos) { this.originPos = pos; } @@ -3924,7 +3924,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory } } - public void makeLandingParticles(BlockPos pos) + public void makeLandingParticles(LocalPos pos) { if (!this.isPlayer() || (!this.noclip && this.worldObj.getGravity(this) != 0.0)) { @@ -4025,7 +4025,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory } } - public boolean canPlayerEdit(BlockPos pos, Facing side, ItemStack stack) + public boolean canPlayerEdit(LocalPos pos, Facing side, ItemStack stack) { return true; } diff --git a/common/src/main/java/common/entity/npc/EntitySlime.java b/common/src/main/java/common/entity/npc/EntitySlime.java index d82952d5..a85bf93e 100755 --- a/common/src/main/java/common/entity/npc/EntitySlime.java +++ b/common/src/main/java/common/entity/npc/EntitySlime.java @@ -12,7 +12,7 @@ import common.init.SoundEvent; import common.pathfinding.PathNavigateGround; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Equipment; import common.util.ExtMath; import common.util.ParticleType; @@ -382,7 +382,7 @@ public class EntitySlime extends EntityNPC */ public boolean getCanSpawnHere() { - BlockPos blockpos = new BlockPos(ExtMath.floord(this.posX), 0, ExtMath.floord(this.posZ)); + LocalPos blockpos = new LocalPos(ExtMath.floord(this.posX), 0, ExtMath.floord(this.posZ)); // if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) // { @@ -392,7 +392,7 @@ public class EntitySlime extends EntityNPC // { // if (this.worldObj.getDifficulty() != Difficulty.PEACEFUL) // { - if (this.worldObj.getState(new BlockPos(this.posX, this.getEntityBoundingBox().minY - 1.0, this.posZ)).getBlock() == Blocks.swamp && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getMoonPhase()) + if (this.worldObj.getState(new LocalPos(this.posX, this.getEntityBoundingBox().minY - 1.0, this.posZ)).getBlock() == Blocks.swamp && this.posY > 50.0D && this.posY < 70.0D && this.rand.floatv() < 0.5F && this.rand.floatv() < this.worldObj.getMoonPhase()) { return super.getCanSpawnHere(); } diff --git a/common/src/main/java/common/entity/npc/EntityUndead.java b/common/src/main/java/common/entity/npc/EntityUndead.java index 82ed28fb..44d3f446 100755 --- a/common/src/main/java/common/entity/npc/EntityUndead.java +++ b/common/src/main/java/common/entity/npc/EntityUndead.java @@ -7,7 +7,6 @@ import common.init.Items; import common.item.ItemStack; import common.rng.Random; import common.world.World; -import common.world.AWorldServer; public class EntityUndead extends EntityNPC { diff --git a/common/src/main/java/common/entity/npc/EntityZombie.java b/common/src/main/java/common/entity/npc/EntityZombie.java index 4f664cbc..c14dfa34 100755 --- a/common/src/main/java/common/entity/npc/EntityZombie.java +++ b/common/src/main/java/common/entity/npc/EntityZombie.java @@ -7,11 +7,10 @@ import common.entity.DamageSource; import common.entity.animal.EntityChicken; import common.entity.types.EntityLiving; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.vars.Vars; import common.world.World; -import common.world.AWorldServer; public class EntityZombie extends EntityNPC { @@ -64,7 +63,7 @@ public class EntityZombie extends EntityNPC int j1 = j + this.rand.range(7, 40) * this.rand.range(-1, 1); int k1 = k + this.rand.range(7, 40) * this.rand.range(-1, 1); - if (this.worldObj.isBlockSolid(new BlockPos(i1, j1 - 1, k1))) + if (this.worldObj.isBlockSolid(new LocalPos(i1, j1 - 1, k1))) { entityzombie.setPosition((double)i1, (double)j1, (double)k1); @@ -167,7 +166,7 @@ public class EntityZombie extends EntityNPC } this.worldObj.spawnEntityInWorld(entityzombie); - this.worldObj.playEffect(1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0); + this.worldObj.playEffect(1016, new LocalPos((int)this.posX, (int)this.posY, (int)this.posZ), 0); } } diff --git a/common/src/main/java/common/entity/npc/PlayerCharacter.java b/common/src/main/java/common/entity/npc/PlayerCharacter.java index a700bad6..84181861 100644 --- a/common/src/main/java/common/entity/npc/PlayerCharacter.java +++ b/common/src/main/java/common/entity/npc/PlayerCharacter.java @@ -1,6 +1,6 @@ package common.entity.npc; -import common.util.BlockPos; +import common.util.LocalPos; -public record PlayerCharacter(String name, String info, Alignment align, String dim, BlockPos pos, String type, int level, String origin) { +public record PlayerCharacter(String name, String info, Alignment align, String dim, LocalPos pos, String type, int level, String origin) { } diff --git a/common/src/main/java/common/entity/projectile/EntityArrow.java b/common/src/main/java/common/entity/projectile/EntityArrow.java index dad55019..95b8c71c 100755 --- a/common/src/main/java/common/entity/projectile/EntityArrow.java +++ b/common/src/main/java/common/entity/projectile/EntityArrow.java @@ -17,7 +17,7 @@ import common.init.Items; import common.init.SoundEvent; import common.item.ItemStack; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.HitPosition; @@ -196,7 +196,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(this.motionY, (double)f) * 180.0D / Math.PI); } - BlockPos blockpos = new BlockPos(this.xTile, this.yTile, this.zTile); + LocalPos blockpos = new LocalPos(this.xTile, this.yTile, this.zTile); State iblockstate = this.worldObj.getState(blockpos); Block block = iblockstate.getBlock(); @@ -248,7 +248,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData if (movingobjectposition != null) { - vec3 = new Vec3(movingobjectposition.vec.xCoord, movingobjectposition.vec.yCoord, movingobjectposition.vec.zCoord); + vec3 = new Vec3(movingobjectposition.vec.x, movingobjectposition.vec.y, movingobjectposition.vec.z); } Entity entity = null; @@ -267,7 +267,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData if (movingobjectposition1 != null) { - double d1 = vec31.squareDistanceTo(movingobjectposition1.vec); + double d1 = vec31.distanceSq(movingobjectposition1.vec); if (d1 < d0 || d0 == 0.0D) { @@ -375,15 +375,15 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData } else { - BlockPos blockpos1 = movingobjectposition.block; + LocalPos blockpos1 = movingobjectposition.block; this.xTile = blockpos1.getX(); this.yTile = blockpos1.getY(); this.zTile = blockpos1.getZ(); State iblockstate1 = this.worldObj.getState(blockpos1); this.inTile = iblockstate1; - this.motionX = (double)((float)(movingobjectposition.vec.xCoord - this.posX)); - this.motionY = (double)((float)(movingobjectposition.vec.yCoord - this.posY)); - this.motionZ = (double)((float)(movingobjectposition.vec.zCoord - this.posZ)); + this.motionX = (double)((float)(movingobjectposition.vec.x - this.posX)); + this.motionY = (double)((float)(movingobjectposition.vec.y - this.posY)); + this.motionZ = (double)((float)(movingobjectposition.vec.z - this.posZ)); float f5 = ExtMath.sqrtd(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.posX -= this.motionX / (double)f5 * 0.05000000074505806D; this.posY -= this.motionY / (double)f5 * 0.05000000074505806D; diff --git a/common/src/main/java/common/entity/projectile/EntityBullet.java b/common/src/main/java/common/entity/projectile/EntityBullet.java index d504debe..bfc3c8e8 100755 --- a/common/src/main/java/common/entity/projectile/EntityBullet.java +++ b/common/src/main/java/common/entity/projectile/EntityBullet.java @@ -11,7 +11,7 @@ import common.entity.types.IObjectData; import common.entity.types.IProjectile; import common.init.SoundEvent; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.HitPosition; @@ -144,7 +144,7 @@ public class EntityBullet extends Entity implements IProjectile, IObjectData { next = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if(hit != null) { - next = new Vec3(hit.vec.xCoord, hit.vec.yCoord, hit.vec.zCoord); + next = new Vec3(hit.vec.x, hit.vec.y, hit.vec.z); } Entity entity = null; @@ -161,7 +161,7 @@ public class EntityBullet extends Entity implements IProjectile, IObjectData { HitPosition entityHit = bb.calculateIntercept(current, next); if(entityHit != null) { - double dist = current.squareDistanceTo(entityHit.vec); + double dist = current.distanceSq(entityHit.vec); if(dist < min || min == 0.0D) { entity = ent; @@ -212,7 +212,7 @@ public class EntityBullet extends Entity implements IProjectile, IObjectData { this.setPosition(this.posX, this.posY, this.posZ); } - protected void onHitBlock(BlockPos pos) { + protected void onHitBlock(LocalPos pos) { if(!this.worldObj.client) { State state = pos != null ? this.worldObj.getState(pos) : null; if(state == null || state.getBlock().onShot((AWorldServer)this.worldObj, pos, state, this)) { diff --git a/common/src/main/java/common/entity/projectile/EntityFireCharge.java b/common/src/main/java/common/entity/projectile/EntityFireCharge.java index 36459adb..9fcd8804 100755 --- a/common/src/main/java/common/entity/projectile/EntityFireCharge.java +++ b/common/src/main/java/common/entity/projectile/EntityFireCharge.java @@ -3,7 +3,7 @@ package common.entity.projectile; import common.entity.DamageSource; import common.entity.types.EntityLiving; import common.init.Blocks; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.HitPosition; import common.vars.Vars; import common.world.World; @@ -67,7 +67,7 @@ public class EntityFireCharge extends EntityProjectile if (flag1) { - BlockPos blockpos = movingObject.block.offset(movingObject.side); + LocalPos blockpos = movingObject.block.offset(movingObject.side); if (this.worldObj.isAirBlock(blockpos)) { diff --git a/common/src/main/java/common/entity/projectile/EntityHook.java b/common/src/main/java/common/entity/projectile/EntityHook.java index 1eec7f8e..64a8f936 100755 --- a/common/src/main/java/common/entity/projectile/EntityHook.java +++ b/common/src/main/java/common/entity/projectile/EntityHook.java @@ -17,7 +17,7 @@ import common.init.Items; import common.init.SoundEvent; import common.item.ItemStack; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.HitPosition; @@ -245,7 +245,7 @@ public class EntityHook extends Entity implements IObjectData if (this.inGround) { - if (this.worldObj.getState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) + if (this.worldObj.getState(new LocalPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) { ++this.ticksInGround; @@ -277,7 +277,7 @@ public class EntityHook extends Entity implements IObjectData if (movingobjectposition != null) { - vec3 = new Vec3(movingobjectposition.vec.xCoord, movingobjectposition.vec.yCoord, movingobjectposition.vec.zCoord); + vec3 = new Vec3(movingobjectposition.vec.x, movingobjectposition.vec.y, movingobjectposition.vec.z); } Entity entity = null; @@ -296,7 +296,7 @@ public class EntityHook extends Entity implements IObjectData if (movingobjectposition1 != null) { - double d2 = vec31.squareDistanceTo(movingobjectposition1.vec); + double d2 = vec31.distanceSq(movingobjectposition1.vec); if (d2 < d0 || d0 == 0.0D) { @@ -386,7 +386,7 @@ public class EntityHook extends Entity implements IObjectData { AWorldServer worldserver = (AWorldServer)this.worldObj; int l = 1; - BlockPos blockpos = (new BlockPos(this)).up(); + LocalPos blockpos = (new LocalPos(this)).up(); if (this.rand.floatv() < 0.25F && this.worldObj.isRainingAt(blockpos, true)) { @@ -427,7 +427,7 @@ public class EntityHook extends Entity implements IObjectData double d13 = this.posX + (double)(f10 * (float)this.ticksCatchableDelay * 0.1F); double d15 = (double)((float)ExtMath.floord(this.getEntityBoundingBox().minY) + 1.0F); double d16 = this.posZ + (double)(f11 * (float)this.ticksCatchableDelay * 0.1F); - Block block1 = worldserver.getState(new BlockPos((int)d13, (int)d15 - 1, (int)d16)).getBlock(); + Block block1 = worldserver.getState(new LocalPos((int)d13, (int)d15 - 1, (int)d16)).getBlock(); if (block1 == Blocks.water || block1 == Blocks.flowing_water) { @@ -468,7 +468,7 @@ public class EntityHook extends Entity implements IObjectData double d12 = this.posX + (double)(ExtMath.sin(f9) * f2 * 0.1F); double d14 = (double)((float)ExtMath.floord(this.getEntityBoundingBox().minY) + 1.0F); double d6 = this.posZ + (double)(ExtMath.cos(f9) * f2 * 0.1F); - Block block = worldserver.getState(new BlockPos((int)d12, (int)d14 - 1, (int)d6)).getBlock(); + Block block = worldserver.getState(new LocalPos((int)d12, (int)d14 - 1, (int)d6)).getBlock(); if (block == Blocks.water || block == Blocks.flowing_water) { diff --git a/common/src/main/java/common/entity/projectile/EntityMissile.java b/common/src/main/java/common/entity/projectile/EntityMissile.java index 04581f9b..9e55dcf1 100755 --- a/common/src/main/java/common/entity/projectile/EntityMissile.java +++ b/common/src/main/java/common/entity/projectile/EntityMissile.java @@ -4,7 +4,7 @@ import common.entity.Entity; import common.entity.EntityType; import common.entity.types.EntityLiving; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ParticleType; import common.world.World; @@ -49,7 +49,7 @@ public class EntityMissile extends EntityBullet { this.worldObj.explode(this.shooter, this, this.posX, this.posY, this.posZ, (float)this.damage, this.flames, true, false); } - protected void onHitBlock(BlockPos pos) { + protected void onHitBlock(LocalPos pos) { if(!this.worldObj.client) this.explode(); } diff --git a/common/src/main/java/common/entity/projectile/EntityPotion.java b/common/src/main/java/common/entity/projectile/EntityPotion.java index f2f1e035..347083c5 100755 --- a/common/src/main/java/common/entity/projectile/EntityPotion.java +++ b/common/src/main/java/common/entity/projectile/EntityPotion.java @@ -12,7 +12,7 @@ import common.init.Items; import common.item.ItemStack; import common.item.consumable.ItemPotion; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.HitPosition; import common.world.World; @@ -141,7 +141,7 @@ public class EntityPotion extends EntityThrowable implements IObjectData } } - this.worldObj.playEffect(2002, new BlockPos(this), ItemRegistry.getId(this.getPotionDamage())); + this.worldObj.playEffect(2002, new LocalPos(this), ItemRegistry.getId(this.getPotionDamage())); this.setDead(); } } diff --git a/common/src/main/java/common/entity/projectile/EntityProjectile.java b/common/src/main/java/common/entity/projectile/EntityProjectile.java index 0fe8a9f5..9f9979dd 100755 --- a/common/src/main/java/common/entity/projectile/EntityProjectile.java +++ b/common/src/main/java/common/entity/projectile/EntityProjectile.java @@ -9,7 +9,7 @@ import common.entity.EntityType; import common.entity.types.EntityLiving; import common.init.BlockRegistry; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.HitPosition; @@ -100,14 +100,14 @@ public abstract class EntityProjectile extends Entity */ public void onUpdate() { - if (this.worldObj.client || (this.shootingEntity == null || !this.shootingEntity.dead) && this.worldObj.isBlockLoaded(new BlockPos(this))) + if (this.worldObj.client || (this.shootingEntity == null || !this.shootingEntity.dead) && this.worldObj.isBlockLoaded(new LocalPos(this))) { super.onUpdate(); this.setFire(1); if (this.inGround) { - if (this.worldObj.getState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) + if (this.worldObj.getState(new LocalPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) { ++this.ticksAlive; @@ -139,7 +139,7 @@ public abstract class EntityProjectile extends Entity if (movingobjectposition != null) { - vec31 = new Vec3(movingobjectposition.vec.xCoord, movingobjectposition.vec.yCoord, movingobjectposition.vec.zCoord); + vec31 = new Vec3(movingobjectposition.vec.x, movingobjectposition.vec.y, movingobjectposition.vec.z); } Entity entity = null; @@ -158,7 +158,7 @@ public abstract class EntityProjectile extends Entity if (movingobjectposition1 != null) { - double d1 = vec3.squareDistanceTo(movingobjectposition1.vec); + double d1 = vec3.distanceSq(movingobjectposition1.vec); if (d1 < d0 || d0 == 0.0D) { @@ -328,9 +328,9 @@ public abstract class EntityProjectile extends Entity if (vec3 != null) { - this.motionX = vec3.xCoord; - this.motionY = vec3.yCoord; - this.motionZ = vec3.zCoord; + this.motionX = vec3.x; + this.motionY = vec3.y; + this.motionZ = vec3.z; this.accelerationX = this.motionX * 0.1D; this.accelerationY = this.motionY * 0.1D; this.accelerationZ = this.motionZ * 0.1D; diff --git a/common/src/main/java/common/entity/types/EntityAnimal.java b/common/src/main/java/common/entity/types/EntityAnimal.java index 068e2253..9d820410 100755 --- a/common/src/main/java/common/entity/types/EntityAnimal.java +++ b/common/src/main/java/common/entity/types/EntityAnimal.java @@ -12,7 +12,7 @@ import common.init.Blocks; import common.init.Items; import common.item.ItemStack; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.util.ParticleType; @@ -91,7 +91,7 @@ public abstract class EntityAnimal extends EntityLiving // } } - public float getBlockPathWeight(BlockPos pos) + public float getBlockPathWeight(LocalPos pos) { return this.worldObj.getState(pos.down()).getBlock() == Blocks.grass ? 10.0F : 0.5F; } @@ -116,7 +116,7 @@ public abstract class EntityAnimal extends EntityLiving int i = ExtMath.floord(this.posX); int j = ExtMath.floord(this.getEntityBoundingBox().minY); int k = ExtMath.floord(this.posZ); - BlockPos blockpos = new BlockPos(i, j, k); + LocalPos blockpos = new LocalPos(i, j, k); return this.spawnableBlocks.contains(this.worldObj.getState(blockpos.down()).getBlock()) && this.isValidSpawnHeight(blockpos.getY()) && super.getCanSpawnHere(); } diff --git a/common/src/main/java/common/entity/types/EntityLiving.java b/common/src/main/java/common/entity/types/EntityLiving.java index 8135ced4..43c4b2a2 100755 --- a/common/src/main/java/common/entity/types/EntityLiving.java +++ b/common/src/main/java/common/entity/types/EntityLiving.java @@ -48,7 +48,7 @@ import common.pathfinding.PathNavigate; import common.pathfinding.PathNavigateGround; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.ExtMath; @@ -142,7 +142,7 @@ public abstract class EntityLiving extends Entity private float radiation; protected int particleTimer; - private BlockPos homePosition = BlockPos.ORIGIN; + private LocalPos homePosition = LocalPos.ORIGIN; private float maximumHomeDistance = -1.0F; protected int growingAge; private float ageWidth = -1.0F; @@ -203,7 +203,7 @@ public abstract class EntityLiving extends Entity { } - protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, LocalPos pos) { if (!this.isInLiquid()) { @@ -218,7 +218,7 @@ public abstract class EntityLiving extends Entity super.updateFallState(y, onGroundIn, blockIn, pos); } - public void makeLandingParticles(BlockPos pos) + public void makeLandingParticles(LocalPos pos) { State iblockstate = this.worldObj.getState(pos); Block block = iblockstate.getBlock(); @@ -582,7 +582,7 @@ public abstract class EntityLiving extends Entity // } // else if(this.leashedTo instanceof EntityLeashKnot) { - BlockPos blockpos = ((EntityLeashKnot)this.leashedTo).getHangingPosition(); + LocalPos blockpos = ((EntityLeashKnot)this.leashedTo).getHangingPosition(); nbttagcompound1.setInt("X", blockpos.getX()); nbttagcompound1.setInt("Y", blockpos.getY()); nbttagcompound1.setInt("Z", blockpos.getZ()); @@ -991,14 +991,14 @@ public abstract class EntityLiving extends Entity for (int i = 0; i < 5; ++i) { Vec3 vec3 = new Vec3(((double)this.rand.floatv() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); - vec3 = vec3.rotatePitch(-this.rotPitch * (float)Math.PI / 180.0F); - vec3 = vec3.rotateYaw(-this.rotYaw * (float)Math.PI / 180.0F); + vec3 = vec3.pitch(-this.rotPitch * (float)Math.PI / 180.0F); + vec3 = vec3.yaw(-this.rotYaw * (float)Math.PI / 180.0F); double d0 = (double)(-this.rand.floatv()) * 0.6D - 0.3D; Vec3 vec31 = new Vec3(((double)this.rand.floatv() - 0.5D) * 0.3D, d0, 0.6D); - vec31 = vec31.rotatePitch(-this.rotPitch * (float)Math.PI / 180.0F); - vec31 = vec31.rotateYaw(-this.rotYaw * (float)Math.PI / 180.0F); - vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); - this.worldObj.clientParticle(ParticleType.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, ItemRegistry.getId(stack.getItem())); + vec31 = vec31.pitch(-this.rotPitch * (float)Math.PI / 180.0F); + vec31 = vec31.yaw(-this.rotYaw * (float)Math.PI / 180.0F); + vec31 = vec31.add(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); + this.worldObj.clientParticle(ParticleType.ITEM_CRACK, vec31.x, vec31.y, vec31.z, ItemRegistry.getId(stack.getItem())); } } @@ -1126,7 +1126,7 @@ public abstract class EntityLiving extends Entity int i = ExtMath.floord(this.posX); int j = ExtMath.floord(this.getEntityBoundingBox().minY); int k = ExtMath.floord(this.posZ); - Block block = this.worldObj.getState(new BlockPos(i, j, k)).getBlock(); + Block block = this.worldObj.getState(new LocalPos(i, j, k)).getBlock(); return (block == Blocks.ladder || block == Blocks.vine); // && (!(this.isPlayer()) || !((EntityNPC)this).isSpectator()); } @@ -1155,7 +1155,7 @@ public abstract class EntityLiving extends Entity int j = ExtMath.floord(this.posX); int k = ExtMath.floord(this.posY - 0.20000000298023224D); int l = ExtMath.floord(this.posZ); - Block block = this.worldObj.getState(new BlockPos(j, k, l)).getBlock(); + Block block = this.worldObj.getState(new LocalPos(j, k, l)).getBlock(); if (block != Blocks.air) { @@ -1445,13 +1445,13 @@ public abstract class EntityLiving extends Entity if (this.worldObj.getCollisionBoxes(axisalignedbb).isEmpty()) { - if (this.worldObj.isBlockSolid(new BlockPos(l, (int)this.posY, i1))) + if (this.worldObj.isBlockSolid(new LocalPos(l, (int)this.posY, i1))) { this.setPositionAndUpdate(this.posX + (double)j, this.posY + 1.0D, this.posZ + (double)k); return; } - if (this.worldObj.isBlockSolid(new BlockPos(l, (int)this.posY - 1, i1)) || this.worldObj.getState(new BlockPos(l, (int)this.posY - 1, i1)).getBlock().getMaterial().isColdLiquid()) + if (this.worldObj.isBlockSolid(new LocalPos(l, (int)this.posY - 1, i1)) || this.worldObj.getState(new LocalPos(l, (int)this.posY - 1, i1)).getBlock().getMaterial().isColdLiquid()) { d0 = this.posX + (double)j; d1 = this.posY + 1.0D; @@ -1525,7 +1525,7 @@ public abstract class EntityLiving extends Entity if (this.onGround) { - f4 = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; + f4 = this.worldObj.getState(new LocalPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; } float f = 0.16277136F / (f4 * f4 * f4); @@ -1545,7 +1545,7 @@ public abstract class EntityLiving extends Entity if (this.onGround) { - f4 = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; + f4 = this.worldObj.getState(new LocalPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; } if (this.isOnLadder()) @@ -1575,7 +1575,7 @@ public abstract class EntityLiving extends Entity this.motionY = 0.2D; } - if (this.worldObj.client && (!this.worldObj.isBlockLoaded(new BlockPos((int)this.posX, 0, (int)this.posZ)) || !this.worldObj.getChunk(new BlockPos((int)this.posX, 0, (int)this.posZ)).isLoaded()) && !this.isPlayer()) + if (this.worldObj.client && (!this.worldObj.isBlockLoaded(new LocalPos((int)this.posX, 0, (int)this.posZ)) || !this.worldObj.getChunk(new LocalPos((int)this.posX, 0, (int)this.posZ)).isLoaded()) && !this.isPlayer()) { if (this.posY > 0.0D) { @@ -1676,7 +1676,7 @@ public abstract class EntityLiving extends Entity if (this.onGround) { - f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; + f = this.worldObj.getState(new LocalPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; } float f1 = 0.16277136F / (f * f * f); @@ -1685,7 +1685,7 @@ public abstract class EntityLiving extends Entity if (this.onGround) { - f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; + f = this.worldObj.getState(new LocalPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; } this.moveEntity(this.motionX, this.motionY, this.motionZ); @@ -2337,7 +2337,7 @@ public abstract class EntityLiving extends Entity this.blockType = null; if(this.isOnLadder()) { Block block = this.worldObj - .getState(new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ)).getBlock(); + .getState(new LocalPos(this.posX, this.getEntityBoundingBox().minY, this.posZ)).getBlock(); if(block == Blocks.ladder) this.blockType = "von einer Leiter"; else if(block == Blocks.vine) @@ -2911,7 +2911,7 @@ public abstract class EntityLiving extends Entity if (this.getLeashed() && this.getLeashedTo() != null && this.getLeashedTo().worldObj == this.worldObj) { Entity entity = this.getLeashedTo(); - this.setHomePosAndDistance(new BlockPos((int)entity.posX, (int)entity.posY, (int)entity.posZ), 5); + this.setHomePosAndDistance(new LocalPos((int)entity.posX, (int)entity.posY, (int)entity.posZ), 5); float f = this.getDistanceToEntity(entity); if (this instanceof EntityTameable && ((EntityTameable)this).isSitting()) @@ -3024,7 +3024,7 @@ public abstract class EntityLiving extends Entity // } // else if(this.leashTag.hasInt("X") && this.leashTag.hasInt("Y") && this.leashTag.hasInt("Z")) { - BlockPos blockpos = new BlockPos(this.leashTag.getInt("X"), this.leashTag.getInt("Y"), + LocalPos blockpos = new LocalPos(this.leashTag.getInt("X"), this.leashTag.getInt("Y"), this.leashTag.getInt("Z")); EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(this.worldObj, blockpos); @@ -3150,14 +3150,14 @@ public abstract class EntityLiving extends Entity // } // } - public float getBlockPathWeight(BlockPos pos) + public float getBlockPathWeight(LocalPos pos) { return 0.0F; } public boolean getCanSpawnHere() { - return this.getBlockPathWeight(new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ)) >= 0.0F; + return this.getBlockPathWeight(new LocalPos(this.posX, this.getEntityBoundingBox().minY, this.posZ)) >= 0.0F; } public boolean hasPath() @@ -3167,21 +3167,21 @@ public abstract class EntityLiving extends Entity public boolean isWithinHomeDistanceCurrentPosition() { - return this.isWithinHomeDistanceFromPosition(new BlockPos(this)); + return this.isWithinHomeDistanceFromPosition(new LocalPos(this)); } - public boolean isWithinHomeDistanceFromPosition(BlockPos pos) + public boolean isWithinHomeDistanceFromPosition(LocalPos pos) { return this.maximumHomeDistance == -1.0F ? true : this.homePosition.distanceSq(pos) < (double)(this.maximumHomeDistance * this.maximumHomeDistance); } - public void setHomePosAndDistance(BlockPos pos, int distance) + public void setHomePosAndDistance(LocalPos pos, int distance) { this.homePosition = pos; this.maximumHomeDistance = (float)distance; } - public BlockPos getHomePosition() + public LocalPos getHomePosition() { return this.homePosition; } diff --git a/common/src/main/java/common/entity/types/EntityThrowable.java b/common/src/main/java/common/entity/types/EntityThrowable.java index 1f226dd2..17306911 100755 --- a/common/src/main/java/common/entity/types/EntityThrowable.java +++ b/common/src/main/java/common/entity/types/EntityThrowable.java @@ -9,7 +9,7 @@ import common.entity.EntityType; import common.init.BlockRegistry; import common.init.Blocks; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.HitPosition; @@ -151,7 +151,7 @@ public abstract class EntityThrowable extends Entity implements IProjectile if (this.inGround) { - if (this.worldObj.getState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) + if (this.worldObj.getState(new LocalPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) { ++this.ticksInGround; @@ -183,7 +183,7 @@ public abstract class EntityThrowable extends Entity implements IProjectile if (movingobjectposition != null) { - vec31 = new Vec3(movingobjectposition.vec.xCoord, movingobjectposition.vec.yCoord, movingobjectposition.vec.zCoord); + vec31 = new Vec3(movingobjectposition.vec.x, movingobjectposition.vec.y, movingobjectposition.vec.z); } if (!this.worldObj.client) @@ -205,7 +205,7 @@ public abstract class EntityThrowable extends Entity implements IProjectile if (movingobjectposition1 != null) { - double d1 = vec3.squareDistanceTo(movingobjectposition1.vec); + double d1 = vec3.distanceSq(movingobjectposition1.vec); if (d1 < d0 || d0 == 0.0D) { diff --git a/common/src/main/java/common/inventory/ContainerEnchantment.java b/common/src/main/java/common/inventory/ContainerEnchantment.java index 2aaeed48..ef6b286f 100755 --- a/common/src/main/java/common/inventory/ContainerEnchantment.java +++ b/common/src/main/java/common/inventory/ContainerEnchantment.java @@ -12,7 +12,7 @@ import common.item.ItemStack; import common.item.material.ItemEnchantedBook; import common.network.IPlayer; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Pair; import common.world.World; @@ -20,7 +20,7 @@ public class ContainerEnchantment extends Container { public IInventory table; private World world; - private BlockPos position; + private LocalPos position; private Random rand; public int seed; public int[] mana; @@ -28,10 +28,10 @@ public class ContainerEnchantment extends Container public ContainerEnchantment(EntityNPC playerInv, World worldIn) { - this(playerInv, worldIn, BlockPos.ORIGIN); + this(playerInv, worldIn, LocalPos.ORIGIN); } - public ContainerEnchantment(EntityNPC playerInv, World worldIn, BlockPos pos) + public ContainerEnchantment(EntityNPC playerInv, World worldIn, LocalPos pos) { this.table = new InventoryBasic(1) { diff --git a/common/src/main/java/common/inventory/ContainerRepair.java b/common/src/main/java/common/inventory/ContainerRepair.java index e0118a85..2373bbaa 100755 --- a/common/src/main/java/common/inventory/ContainerRepair.java +++ b/common/src/main/java/common/inventory/ContainerRepair.java @@ -10,7 +10,7 @@ import common.entity.npc.EntityNPC; import common.item.ItemStack; import common.item.material.ItemEnchantedBook; import common.network.IPlayer; -import common.util.BlockPos; +import common.util.LocalPos; import common.vars.Vars; import common.world.State; import common.world.World; @@ -20,16 +20,16 @@ public class ContainerRepair extends Container private IInventory outputSlot; private IInventory inputSlots; private World theWorld; - private BlockPos selfPosition; + private LocalPos selfPosition; public int maximumCost; private int materialCost; public ContainerRepair(EntityNPC playerInventory, World worldIn) { - this(playerInventory, worldIn, BlockPos.ORIGIN); + this(playerInventory, worldIn, LocalPos.ORIGIN); } - public ContainerRepair(EntityNPC playerInventory, final World worldIn, final BlockPos blockPosIn) + public ContainerRepair(EntityNPC playerInventory, final World worldIn, final LocalPos blockPosIn) { this.outputSlot = new InventoryCraftResult(); this.inputSlots = new InventoryBasic(2) diff --git a/common/src/main/java/common/inventory/ContainerWorkbench.java b/common/src/main/java/common/inventory/ContainerWorkbench.java index bce75c9e..d6330646 100755 --- a/common/src/main/java/common/inventory/ContainerWorkbench.java +++ b/common/src/main/java/common/inventory/ContainerWorkbench.java @@ -4,7 +4,7 @@ import common.block.tech.BlockWorkbench; import common.entity.npc.EntityNPC; import common.init.CraftingRegistry; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class ContainerWorkbench extends Container @@ -13,10 +13,10 @@ public class ContainerWorkbench extends Container public final InventoryCrafting craftMatrix; public final IInventory craftResult = new InventoryCraftResult(); private final World worldObj; - private final BlockPos pos; + private final LocalPos pos; private final BlockWorkbench block; - public ContainerWorkbench(EntityNPC playerInventory, World worldIn, BlockPos posIn, BlockWorkbench block) + public ContainerWorkbench(EntityNPC playerInventory, World worldIn, LocalPos posIn, BlockWorkbench block) { int size = block.getSize(); this.block = block; diff --git a/common/src/main/java/common/inventory/InventoryWarpChest.java b/common/src/main/java/common/inventory/InventoryWarpChest.java index ea65e9ad..4f8a49d3 100755 --- a/common/src/main/java/common/inventory/InventoryWarpChest.java +++ b/common/src/main/java/common/inventory/InventoryWarpChest.java @@ -6,18 +6,18 @@ import common.init.Blocks; import common.item.ItemStack; import common.tags.TagObject; import java.util.List; -import common.util.BlockPos; +import common.util.LocalPos; public class InventoryWarpChest extends InventoryBasic { - private BlockPos position; + private LocalPos position; public InventoryWarpChest() { super(27); } - public void setPosition(BlockPos pos) + public void setPosition(LocalPos pos) { this.position = pos; } diff --git a/common/src/main/java/common/item/Item.java b/common/src/main/java/common/item/Item.java index 1f25a121..c80ca580 100755 --- a/common/src/main/java/common/item/Item.java +++ b/common/src/main/java/common/item/Item.java @@ -11,7 +11,7 @@ import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.entity.types.IProjectile; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.util.Facing; @@ -193,7 +193,7 @@ public class Item { float f6 = f3 * f4; float f7 = f2 * f4; double d3 = 5.0D; - Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + Vec3 vec31 = vec3.add((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); } @@ -211,11 +211,11 @@ public class Item { return stack; } - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { return this.block != null && this.block.place(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ); } - public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) { + public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) { return false; } @@ -237,7 +237,7 @@ public class Item { return false; } - public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn) { + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, LocalPos pos, EntityLiving playerIn) { return false; } @@ -348,7 +348,7 @@ public class Item { } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { if(this.block == null || !this.block.dispense(world, source, position, blockpos, facing, stack)) BlockDispenser.dispense(world, 6.0, facing, position, stack.split(1)); return stack; diff --git a/common/src/main/java/common/item/consumable/ItemPotion.java b/common/src/main/java/common/item/consumable/ItemPotion.java index bd25cfca..c6446ad8 100755 --- a/common/src/main/java/common/item/consumable/ItemPotion.java +++ b/common/src/main/java/common/item/consumable/ItemPotion.java @@ -17,7 +17,7 @@ import common.item.ItemControl; import common.item.ItemStack; import common.item.StackSize; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.Facing; import common.util.Pair; @@ -145,7 +145,7 @@ public class ItemPotion extends Item return ItemAction.DRINK; } - public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) { + public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) { if(control == ItemControl.TERTIARY || control == ItemControl.QUARTERNARY) { stack.decrSize(); world.playSoundAtEntity(player, SoundEvent.THROW, 0.5F); @@ -259,8 +259,8 @@ public class ItemPotion extends Item } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - return this.dispenseProjectile(world, facing, stack, new EntityPotion(world, position.xCoord, position.yCoord, position.zCoord, stack.copy()), 1.375f, 3.0f); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + return this.dispenseProjectile(world, facing, stack, new EntityPotion(world, position.x, position.y, position.z, stack.copy()), 1.375f, 3.0f); } @Serverside diff --git a/common/src/main/java/common/item/consumable/ItemSeedFood.java b/common/src/main/java/common/item/consumable/ItemSeedFood.java index f68431c7..04a7aab1 100755 --- a/common/src/main/java/common/item/consumable/ItemSeedFood.java +++ b/common/src/main/java/common/item/consumable/ItemSeedFood.java @@ -4,7 +4,7 @@ import common.block.Block; import common.block.foliage.BlockCrops; import common.entity.npc.EntityNPC; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.World; @@ -20,7 +20,7 @@ public class ItemSeedFood extends ItemFood this.soil = soil; } - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (side != Facing.UP) { diff --git a/common/src/main/java/common/item/material/ItemArmor.java b/common/src/main/java/common/item/material/ItemArmor.java index 7fd3b28e..61d6ed45 100755 --- a/common/src/main/java/common/item/material/ItemArmor.java +++ b/common/src/main/java/common/item/material/ItemArmor.java @@ -11,7 +11,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Clientside; import common.util.Color; @@ -96,8 +96,8 @@ public class ItemArmor extends Item { } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - BlockPos pos = blockpos.offset(facing); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + LocalPos pos = blockpos.offset(facing); int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); diff --git a/common/src/main/java/common/item/material/ItemBottle.java b/common/src/main/java/common/item/material/ItemBottle.java index 43f5700e..9b54c5c5 100755 --- a/common/src/main/java/common/item/material/ItemBottle.java +++ b/common/src/main/java/common/item/material/ItemBottle.java @@ -6,7 +6,7 @@ import common.init.Items; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.HitPosition; import common.world.World; @@ -32,7 +32,7 @@ public class ItemBottle extends Item { if (movingobjectposition.type == HitPosition.ObjectType.BLOCK) { - BlockPos blockpos = movingobjectposition.block; + LocalPos blockpos = movingobjectposition.block; if (!World.isValidXZ(blockpos)) { diff --git a/common/src/main/java/common/item/material/ItemBucket.java b/common/src/main/java/common/item/material/ItemBucket.java index 831195ce..524ece80 100755 --- a/common/src/main/java/common/item/material/ItemBucket.java +++ b/common/src/main/java/common/item/material/ItemBucket.java @@ -25,9 +25,8 @@ import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; import common.tileentity.DeviceDispenser; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; -import common.util.Color; import common.util.Facing; import common.util.HitPosition; import common.util.ParticleType; @@ -49,7 +48,7 @@ public class ItemBucket extends Item return MAPPING.get(liquid); } - private static boolean test(AWorldServer world, BlockPos pos, Set blocks, int max, BlockPos origin, int radius) { + private static boolean test(AWorldServer world, LocalPos pos, Set blocks, int max, LocalPos origin, int radius) { if(pos.getY() < -World.MAX_SIZE_Y || pos.getY() > max) return false; if(pos.getX() < origin.getX() - radius || pos.getX() > origin.getX() + radius) @@ -62,9 +61,9 @@ public class ItemBucket extends Item return blocks == null ? block instanceof BlockLiquid : blocks.contains(block); } - private static void setRecursive(AWorldServer world, BlockPos origin, int radius, BlockStaticLiquid liquid) { - Queue queue = new ArrayDeque(); - Set visited = new HashSet(); + private static void setRecursive(AWorldServer world, LocalPos origin, int radius, BlockStaticLiquid liquid) { + Queue queue = new ArrayDeque(); + Set visited = new HashSet(); List dirs = new ArrayList(); Set blocks = liquid == null ? null : Sets.newHashSet(liquid.getFlowingBlock(), liquid, Blocks.air); State state = (liquid == null ? Blocks.air : liquid).getState(); @@ -90,7 +89,7 @@ public class ItemBucket extends Item for(int x = -1; x <= 1; x++) { for(int y = -1; y <= 1; y++) { for(int z = -1; z <= 1; z++) { - BlockPos pos = new BlockPos(origin.getX() + x, origin.getY() + y, origin.getZ() + z); + LocalPos pos = new LocalPos(origin.getX() + x, origin.getY() + y, origin.getZ() + z); if (!visited.contains(pos)) { if(test(world, pos, blocks, max, origin, radius)) queue.add(pos); @@ -99,11 +98,11 @@ public class ItemBucket extends Item } } } - BlockPos loc; + LocalPos loc; while ((loc = queue.poll()) != null) { world.setState(loc, state); for (Vec3i dir : dirs) { - BlockPos pos = loc.add(dir); + LocalPos pos = loc.add(dir); if (!visited.contains(pos)) { visited.add(pos); if (test(world, pos, blocks, max, origin, radius)) @@ -164,7 +163,7 @@ public class ItemBucket extends Item { if (movingobjectposition.type == HitPosition.ObjectType.BLOCK) { - BlockPos blockpos = movingobjectposition.block; + LocalPos blockpos = movingobjectposition.block; if (!World.isValidXZ(blockpos)) { @@ -221,7 +220,7 @@ public class ItemBucket extends Item // return new ItemStack(Items.bucket); // } - BlockPos blockpos1 = blockpos.offset(movingobjectposition.side); + LocalPos blockpos1 = blockpos.offset(movingobjectposition.side); if (!playerIn.canPlayerEdit(blockpos1, movingobjectposition.side, itemStackIn)) { @@ -266,7 +265,7 @@ public class ItemBucket extends Item } } - public boolean tryPlaceContainedLiquid(World worldIn, BlockPos pos) + public boolean tryPlaceContainedLiquid(World worldIn, LocalPos pos) { if (this.liquid == null) { @@ -339,11 +338,11 @@ public class ItemBucket extends Item } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { if(this.recursive) return super.dispenseStack(world, source, position, blockpos, facing, stack); if(this.liquid == null) { - BlockPos pos = blockpos.offset(facing); + LocalPos pos = blockpos.offset(facing); State iblockstate = world.getState(pos); Block block = iblockstate.getBlock(); Material material = block.getMaterial(); @@ -372,7 +371,7 @@ public class ItemBucket extends Item return stack; } else { - BlockPos pos = blockpos.offset(facing); + LocalPos pos = blockpos.offset(facing); if (this.tryPlaceContainedLiquid(world, pos)) { diff --git a/common/src/main/java/common/item/material/ItemDye.java b/common/src/main/java/common/item/material/ItemDye.java index 82891f4e..317f2fcc 100755 --- a/common/src/main/java/common/item/material/ItemDye.java +++ b/common/src/main/java/common/item/material/ItemDye.java @@ -11,7 +11,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.item.StackSize; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Color; import common.world.State; @@ -39,7 +39,7 @@ public class ItemDye extends Item { return this.color; } - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) { diff --git a/common/src/main/java/common/item/material/ItemGrindedBones.java b/common/src/main/java/common/item/material/ItemGrindedBones.java index e96d2be2..d641763d 100644 --- a/common/src/main/java/common/item/material/ItemGrindedBones.java +++ b/common/src/main/java/common/item/material/ItemGrindedBones.java @@ -7,7 +7,7 @@ import common.init.Blocks; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.Facing; import common.util.ParticleType; @@ -18,7 +18,7 @@ import common.world.World; import common.world.AWorldServer; public class ItemGrindedBones extends Item { - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) { @@ -40,7 +40,7 @@ public class ItemGrindedBones extends Item { } } - public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) + public static boolean applyBonemeal(ItemStack stack, World worldIn, LocalPos target) { State iblockstate = worldIn.getState(target); @@ -68,7 +68,7 @@ public class ItemGrindedBones extends Item { } @Clientside - public static void spawnParticles(World worldIn, BlockPos pos, int amount) + public static void spawnParticles(World worldIn, LocalPos pos, int amount) { if (amount == 0) { @@ -89,8 +89,8 @@ public class ItemGrindedBones extends Item { } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - BlockPos pos = blockpos = blockpos.offset(facing); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + LocalPos pos = blockpos = blockpos.offset(facing); if (applyBonemeal(stack, world, pos)) { diff --git a/common/src/main/java/common/item/material/ItemSeeds.java b/common/src/main/java/common/item/material/ItemSeeds.java index c1310f76..1051808d 100755 --- a/common/src/main/java/common/item/material/ItemSeeds.java +++ b/common/src/main/java/common/item/material/ItemSeeds.java @@ -6,7 +6,7 @@ import common.entity.npc.EntityNPC; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.World; @@ -22,7 +22,7 @@ public class ItemSeeds extends Item this.setTab(CheatTab.MATERIALS); } - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (side != Facing.UP) { diff --git a/common/src/main/java/common/item/projectile/ItemChargedOrb.java b/common/src/main/java/common/item/projectile/ItemChargedOrb.java index 38705053..5d0ac650 100755 --- a/common/src/main/java/common/item/projectile/ItemChargedOrb.java +++ b/common/src/main/java/common/item/projectile/ItemChargedOrb.java @@ -9,7 +9,7 @@ import common.init.SoundEvent; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.ParticleType; import common.util.Color; @@ -46,7 +46,7 @@ public class ItemChargedOrb extends Item return itemStackIn.getItemDamage() >= this.getMaxDamage() ? new ItemStack(Items.orb) : itemStackIn; } - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { State iblockstate = worldIn.getState(pos); @@ -78,7 +78,7 @@ public class ItemChargedOrb extends Item for (int k = -2; k <= 2; ++k) { - BlockPos blockpos1 = pos.offset(enumfacing1, k); + LocalPos blockpos1 = pos.offset(enumfacing1, k); State iblockstate1 = worldIn.getState(blockpos1); if (iblockstate1.getBlock() == Blocks.portal_frame) @@ -101,11 +101,11 @@ public class ItemChargedOrb extends Item if (flag && j == l + 2) { - BlockPos blockpos = pos.offset(enumfacing, 4); + LocalPos blockpos = pos.offset(enumfacing, 4); for (int i1 = l; i1 <= j; ++i1) { - BlockPos blockpos2 = blockpos.offset(enumfacing1, i1); + LocalPos blockpos2 = blockpos.offset(enumfacing1, i1); State iblockstate3 = worldIn.getState(blockpos2); if (iblockstate3.getBlock() != Blocks.portal_frame || !((Boolean)iblockstate3.getValue(BlockPortalFrame.ORB)).booleanValue()) @@ -121,7 +121,7 @@ public class ItemChargedOrb extends Item for (int l1 = 1; l1 <= 3; ++l1) { - BlockPos blockpos3 = blockpos.offset(enumfacing, l1); + LocalPos blockpos3 = blockpos.offset(enumfacing, l1); State iblockstate2 = worldIn.getState(blockpos3); if (iblockstate2.getBlock() != Blocks.portal_frame || !((Boolean)iblockstate2.getValue(BlockPortalFrame.ORB)).booleanValue()) @@ -140,7 +140,7 @@ public class ItemChargedOrb extends Item for (int i2 = 1; i2 <= 3; ++i2) { - BlockPos blockpos4 = blockpos.offset(enumfacing, i2); + LocalPos blockpos4 = blockpos.offset(enumfacing, i2); worldIn.setState(blockpos4, Blocks.floor_portal.getState(), 2); } } diff --git a/common/src/main/java/common/item/projectile/ItemDie.java b/common/src/main/java/common/item/projectile/ItemDie.java index a68091e1..99875143 100755 --- a/common/src/main/java/common/item/projectile/ItemDie.java +++ b/common/src/main/java/common/item/projectile/ItemDie.java @@ -11,7 +11,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Pair; import common.util.Serverside; @@ -80,8 +80,8 @@ public class ItemDie extends Item } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - return this.dispenseProjectile(world, facing, stack, new EntityDie(world, position.xCoord, position.yCoord, position.zCoord, this.sides), 0.275f, 30.0f); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + return this.dispenseProjectile(world, facing, stack, new EntityDie(world, position.x, position.y, position.z, this.sides), 0.275f, 30.0f); } @Serverside diff --git a/common/src/main/java/common/item/projectile/ItemDynamite.java b/common/src/main/java/common/item/projectile/ItemDynamite.java index d9e2928d..9fa094a3 100755 --- a/common/src/main/java/common/item/projectile/ItemDynamite.java +++ b/common/src/main/java/common/item/projectile/ItemDynamite.java @@ -7,7 +7,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Facing; import common.util.Serverside; @@ -44,8 +44,8 @@ public class ItemDynamite extends Item { } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - return this.dispenseProjectile(world, facing, stack, new EntityDynamite(world, position.xCoord, position.yCoord, position.zCoord, this.power)); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + return this.dispenseProjectile(world, facing, stack, new EntityDynamite(world, position.x, position.y, position.z, this.power)); } @Serverside diff --git a/common/src/main/java/common/item/projectile/ItemEgg.java b/common/src/main/java/common/item/projectile/ItemEgg.java index 83ae70b6..b050fdc5 100755 --- a/common/src/main/java/common/item/projectile/ItemEgg.java +++ b/common/src/main/java/common/item/projectile/ItemEgg.java @@ -7,7 +7,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Serverside; import common.util.Vec3; @@ -43,8 +43,8 @@ public class ItemEgg extends Item } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - return this.dispenseProjectile(world, facing, stack, new EntityEgg(world, position.xCoord, position.yCoord, position.zCoord)); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + return this.dispenseProjectile(world, facing, stack, new EntityEgg(world, position.x, position.y, position.z)); } @Serverside diff --git a/common/src/main/java/common/item/projectile/ItemFireball.java b/common/src/main/java/common/item/projectile/ItemFireball.java index 7114755e..105806f0 100755 --- a/common/src/main/java/common/item/projectile/ItemFireball.java +++ b/common/src/main/java/common/item/projectile/ItemFireball.java @@ -8,7 +8,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Serverside; import common.util.Vec3; @@ -25,7 +25,7 @@ public class ItemFireball extends Item /** * Called when a Block is right-clicked with this Item */ - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -58,10 +58,10 @@ public class ItemFireball extends Item } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - double d0 = position.xCoord + (double)((float)facing.getFrontOffsetX() * 0.3F); - double d1 = position.yCoord + (double)((float)facing.getFrontOffsetY() * 0.3F); - double d2 = position.zCoord + (double)((float)facing.getFrontOffsetZ() * 0.3F); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + double d0 = position.x + (double)((float)facing.getFrontOffsetX() * 0.3F); + double d1 = position.y + (double)((float)facing.getFrontOffsetY() * 0.3F); + double d2 = position.z + (double)((float)facing.getFrontOffsetZ() * 0.3F); double d3 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetX(); double d4 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetY(); double d5 = world.rand.gaussian() * 0.05D + (double)facing.getFrontOffsetZ(); diff --git a/common/src/main/java/common/item/projectile/ItemSnowball.java b/common/src/main/java/common/item/projectile/ItemSnowball.java index 31a1cf6c..c5dc7cab 100755 --- a/common/src/main/java/common/item/projectile/ItemSnowball.java +++ b/common/src/main/java/common/item/projectile/ItemSnowball.java @@ -7,7 +7,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Serverside; import common.util.Vec3; @@ -43,8 +43,8 @@ public class ItemSnowball extends Item } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - return this.dispenseProjectile(world, facing, stack, new EntitySnowball(world, position.xCoord, position.yCoord, position.zCoord)); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + return this.dispenseProjectile(world, facing, stack, new EntitySnowball(world, position.x, position.y, position.z)); } @Serverside diff --git a/common/src/main/java/common/item/spawner/ItemBoat.java b/common/src/main/java/common/item/spawner/ItemBoat.java index d0140446..ed479d25 100755 --- a/common/src/main/java/common/item/spawner/ItemBoat.java +++ b/common/src/main/java/common/item/spawner/ItemBoat.java @@ -11,7 +11,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.Facing; @@ -48,7 +48,7 @@ public class ItemBoat extends Item float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 5.0D; - Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); + Vec3 vec31 = vec3.add((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); HitPosition movingobjectposition = worldIn.rayTraceBlocks(vec3, vec31, true); if (movingobjectposition == null) @@ -60,7 +60,7 @@ public class ItemBoat extends Item Vec3 vec32 = playerIn.getLook(f); boolean flag = false; float f9 = 1.0F; - List list = worldIn.getEntitiesWithinAABBExcludingEntity(playerIn, playerIn.getEntityBoundingBox().addCoord(vec32.xCoord * d3, vec32.yCoord * d3, vec32.zCoord * d3).expand((double)f9, (double)f9, (double)f9)); + List list = worldIn.getEntitiesWithinAABBExcludingEntity(playerIn, playerIn.getEntityBoundingBox().addCoord(vec32.x * d3, vec32.y * d3, vec32.z * d3).expand((double)f9, (double)f9, (double)f9)); for (int i = 0; i < list.size(); ++i) { @@ -86,7 +86,7 @@ public class ItemBoat extends Item { if (movingobjectposition.type == HitPosition.ObjectType.BLOCK) { - BlockPos blockpos = movingobjectposition.block; + LocalPos blockpos = movingobjectposition.block; if (worldIn.getState(blockpos).getBlock() == Blocks.snow_layer) { @@ -120,11 +120,11 @@ public class ItemBoat extends Item } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { double d0 = blockpos.getX() + 0.5 + (double)((float)facing.getFrontOffsetX() * 1.125F); double d1 = blockpos.getY() + 0.5 + (double)((float)facing.getFrontOffsetY() * 1.125F); double d2 = blockpos.getZ() + 0.5 + (double)((float)facing.getFrontOffsetZ() * 1.125F); - BlockPos pos = blockpos.offset(facing); + LocalPos pos = blockpos.offset(facing); Block block = world.getState(pos).getBlock(); double d3; diff --git a/common/src/main/java/common/item/spawner/ItemCharTemplate.java b/common/src/main/java/common/item/spawner/ItemCharTemplate.java index fb643805..f2b18e0f 100755 --- a/common/src/main/java/common/item/spawner/ItemCharTemplate.java +++ b/common/src/main/java/common/item/spawner/ItemCharTemplate.java @@ -17,7 +17,7 @@ import common.init.EntityRegistry; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.util.Facing; @@ -70,7 +70,7 @@ public class ItemCharTemplate extends Item tooltip.add(Color.ORANGE + "Herkunft: " + (dim == null ? "???" : dim.getDisplay())); } - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -121,7 +121,7 @@ public class ItemCharTemplate extends Item { if (movingobjectposition.type == HitPosition.ObjectType.BLOCK) { - BlockPos blockpos = movingobjectposition.block; + LocalPos blockpos = movingobjectposition.block; if (!World.isValidXZ(blockpos)) { diff --git a/common/src/main/java/common/item/spawner/ItemMinecart.java b/common/src/main/java/common/item/spawner/ItemMinecart.java index 78da1fb1..04bb04e5 100755 --- a/common/src/main/java/common/item/spawner/ItemMinecart.java +++ b/common/src/main/java/common/item/spawner/ItemMinecart.java @@ -9,7 +9,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Serverside; import common.util.Vec3; @@ -29,7 +29,7 @@ public class ItemMinecart extends Item /** * Called when a Block is right-clicked with this Item */ - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { State iblockstate = worldIn.getState(pos); @@ -71,11 +71,11 @@ public class ItemMinecart extends Item } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { double d0 = blockpos.getX() + 0.5 + (double)facing.getFrontOffsetX() * 1.125D; double d1 = Math.floor(blockpos.getY() + 0.5) + (double)facing.getFrontOffsetY(); double d2 = blockpos.getZ() + 0.5 + (double)facing.getFrontOffsetZ() * 1.125D; - BlockPos pos = blockpos.offset(facing); + LocalPos pos = blockpos.offset(facing); State iblockstate = world.getState(pos); BlockRail.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRail ? (BlockRail.EnumRailDirection)iblockstate.getValue(BlockRail.SHAPE) : BlockRail.EnumRailDirection.NORTH_SOUTH; double d3; diff --git a/common/src/main/java/common/item/spawner/ItemMobTemplate.java b/common/src/main/java/common/item/spawner/ItemMobTemplate.java index c64ee240..fe84d6b8 100755 --- a/common/src/main/java/common/item/spawner/ItemMobTemplate.java +++ b/common/src/main/java/common/item/spawner/ItemMobTemplate.java @@ -15,7 +15,7 @@ import common.init.EntityRegistry; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.util.Facing; @@ -66,7 +66,7 @@ public class ItemMobTemplate extends Item /** * Called when a Block is right-clicked with this Item */ - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -121,7 +121,7 @@ public class ItemMobTemplate extends Item { if (movingobjectposition.type == HitPosition.ObjectType.BLOCK) { - BlockPos blockpos = movingobjectposition.block; + LocalPos blockpos = movingobjectposition.block; if (!World.isValidXZ(blockpos)) { diff --git a/common/src/main/java/common/item/tool/ItemCamera.java b/common/src/main/java/common/item/tool/ItemCamera.java index 57559453..d64132f0 100755 --- a/common/src/main/java/common/item/tool/ItemCamera.java +++ b/common/src/main/java/common/item/tool/ItemCamera.java @@ -4,7 +4,7 @@ import common.entity.npc.EntityNPC; import common.item.ItemControl; import common.item.Item; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.world.World; @@ -14,10 +14,10 @@ public class ItemCamera extends Item { this.setMagnetic(); } - public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) { + public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) { if(control == ItemControl.SECONDARY) { if(!world.client) - world.playEffect(1024, new BlockPos(player.posX, player.posY + player.getEyeHeight(), player.posZ), 0); + world.playEffect(1024, new LocalPos(player.posX, player.posY + player.getEyeHeight(), player.posZ), 0); return true; } return false; diff --git a/common/src/main/java/common/item/tool/ItemEditor.java b/common/src/main/java/common/item/tool/ItemEditor.java index fb0ef8ca..67dad6ce 100755 --- a/common/src/main/java/common/item/tool/ItemEditor.java +++ b/common/src/main/java/common/item/tool/ItemEditor.java @@ -5,7 +5,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemControl; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.World; public class ItemEditor extends Item { @@ -14,7 +14,7 @@ public class ItemEditor extends Item { this.setTab(CheatTab.TOOLS); } - public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) { + public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) { if(!world.client && control == ItemControl.TERTIARY && player.connection.isAdmin()) player.connection.setSelectMode(); if(!world.client && (control == ItemControl.PRIMARY || control == ItemControl.SECONDARY) && player.connection.isAdmin()) diff --git a/common/src/main/java/common/item/tool/ItemFire.java b/common/src/main/java/common/item/tool/ItemFire.java index 8c512424..ad224bb7 100755 --- a/common/src/main/java/common/item/tool/ItemFire.java +++ b/common/src/main/java/common/item/tool/ItemFire.java @@ -11,7 +11,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Serverside; import common.util.Vec3; @@ -37,7 +37,7 @@ public class ItemFire extends Item /** * Called when a Block is right-clicked with this Item */ - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { pos = pos.offset(side); @@ -59,8 +59,8 @@ public class ItemFire extends Item } @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - BlockPos pos = blockpos = blockpos.offset(facing); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + LocalPos pos = blockpos = blockpos.offset(facing); if (world.isAirBlock(pos)) { diff --git a/common/src/main/java/common/item/tool/ItemHoe.java b/common/src/main/java/common/item/tool/ItemHoe.java index 68735d4b..d1fd4ed0 100755 --- a/common/src/main/java/common/item/tool/ItemHoe.java +++ b/common/src/main/java/common/item/tool/ItemHoe.java @@ -7,7 +7,7 @@ import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; import common.item.WieldType; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import common.world.World; @@ -20,7 +20,7 @@ public class ItemHoe extends Item this.setTab(CheatTab.TOOLS); } - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) { @@ -53,7 +53,7 @@ public class ItemHoe extends Item } } - protected boolean useHoe(ItemStack stack, EntityNPC player, World worldIn, BlockPos target, State newState) + protected boolean useHoe(ItemStack stack, EntityNPC player, World worldIn, LocalPos target, State newState) { if(newState.getBlock().getSound().getStepSound() != null) worldIn.sendSound(newState.getBlock().getSound().getStepSound(), (double)((float)target.getX() + 0.5F), (double)((float)target.getY() + 0.5F), (double)((float)target.getZ() + 0.5F), 1.0F); diff --git a/common/src/main/java/common/item/tool/ItemLead.java b/common/src/main/java/common/item/tool/ItemLead.java index 6d4a3848..e55e59e4 100755 --- a/common/src/main/java/common/item/tool/ItemLead.java +++ b/common/src/main/java/common/item/tool/ItemLead.java @@ -8,7 +8,7 @@ import common.entity.types.EntityLiving; import common.item.CheatTab; import common.item.Item; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.world.World; @@ -23,7 +23,7 @@ public class ItemLead extends Item /** * Called when a Block is right-clicked with this Item */ - public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) + public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { Block block = worldIn.getState(pos).getBlock(); @@ -45,7 +45,7 @@ public class ItemLead extends Item } } - public static boolean attachToFence(EntityNPC player, World worldIn, BlockPos fence) + public static boolean attachToFence(EntityNPC player, World worldIn, LocalPos fence) { EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(worldIn, fence); boolean flag = false; diff --git a/common/src/main/java/common/item/tool/ItemMagnet.java b/common/src/main/java/common/item/tool/ItemMagnet.java index f0a1f780..bbdc192b 100755 --- a/common/src/main/java/common/item/tool/ItemMagnet.java +++ b/common/src/main/java/common/item/tool/ItemMagnet.java @@ -54,7 +54,7 @@ public class ItemMagnet extends Item { else { Vec3 vec = new Vec3(playerIn.posX - entity.posX, playerIn.posY - entity.posY, playerIn.posZ - entity.posZ); vec = vec.normalize(); - entity.addVelocity(vec.xCoord * speed, vec.yCoord * speed, vec.zCoord * speed); + entity.addVelocity(vec.x * speed, vec.y * speed, vec.z * speed); } } } diff --git a/common/src/main/java/common/item/tool/ItemScanner.java b/common/src/main/java/common/item/tool/ItemScanner.java index 6cd24b16..e7fde8c1 100755 --- a/common/src/main/java/common/item/tool/ItemScanner.java +++ b/common/src/main/java/common/item/tool/ItemScanner.java @@ -3,7 +3,7 @@ package common.item.tool; import common.entity.npc.EntityNPC; import common.item.ItemStack; import common.item.WieldType; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Color; import common.util.Vec3; import common.world.AWorldServer; @@ -15,9 +15,9 @@ public class ItemScanner extends ItemWand { public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec) { - BlockPos pos = new BlockPos(vec); + LocalPos pos = new LocalPos(vec); player.connection.addHotbar(Color.NEON + "* Position in %s: %.1f %.1f %.1f, %.1f K, %.1f °C, G: %.1f °C, %.1f %%", world.dimension.getDisplay(), - vec.xCoord, vec.yCoord, vec.zCoord, + vec.x, vec.y, vec.z, world.getTemperatureK(pos), world.getTemperatureC(pos), world.getGenTemperature(pos.getX(), pos.getZ()), world.getGenHumidity(pos.getX(), pos.getZ())); } diff --git a/common/src/main/java/common/item/tool/ItemSpaceNavigator.java b/common/src/main/java/common/item/tool/ItemSpaceNavigator.java index ea69cfcf..cc704315 100755 --- a/common/src/main/java/common/item/tool/ItemSpaceNavigator.java +++ b/common/src/main/java/common/item/tool/ItemSpaceNavigator.java @@ -6,7 +6,7 @@ import common.entity.npc.EntityNPC; import common.item.Item; import common.item.ItemControl; import common.item.ItemStack; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.Color; import common.world.World; @@ -31,7 +31,7 @@ public class ItemSpaceNavigator extends Item { return this.localTime; } - public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) { + public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) { if(world.client && control == ItemControl.QUARTERNARY) this.local ^= true; return false; @@ -39,7 +39,7 @@ public class ItemSpaceNavigator extends Item { @Clientside public String getHotbarText(EntityNPC player, ItemStack stack) { - BlockPos pos = player.getPosition(); + LocalPos pos = player.getPosition(); return Color.ORANGE + (this.local ? this.localTime : player.worldObj.formatEpoch()) + " / " + String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() + Color.ORANGE, pos.getX(), pos.getY(), pos.getZ()); @@ -53,7 +53,7 @@ public class ItemSpaceNavigator extends Item { for(int z = dims.length - 1; z >= 0; z--) { tooltip.add(Color.ORANGE + dims[z]); } - BlockPos pos = player.getPosition(); + LocalPos pos = player.getPosition(); tooltip.add(Color.ORANGE + String.format("%s bei %d, %d, %d", player.worldObj.dimension.getDisplay() + Color.ORANGE, pos.getX(), pos.getY(), pos.getZ())); } diff --git a/common/src/main/java/common/item/tool/ItemTool.java b/common/src/main/java/common/item/tool/ItemTool.java index 45cd1bfc..31e3e05c 100755 --- a/common/src/main/java/common/item/tool/ItemTool.java +++ b/common/src/main/java/common/item/tool/ItemTool.java @@ -13,7 +13,7 @@ import common.item.Item; import common.item.ItemAction; import common.item.ItemStack; import common.item.WieldType; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.Color; import common.util.Equipment; @@ -54,7 +54,7 @@ public class ItemTool extends Item { return true; } - public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLiving player) { + public boolean onBlockDestroyed(ItemStack stack, World world, Block block, LocalPos pos, EntityLiving player) { if(block.getHardness(world, pos) != 0.0f) stack.damage(1, player); return true; diff --git a/common/src/main/java/common/item/tool/ItemWand.java b/common/src/main/java/common/item/tool/ItemWand.java index b128aa12..ad74e85b 100755 --- a/common/src/main/java/common/item/tool/ItemWand.java +++ b/common/src/main/java/common/item/tool/ItemWand.java @@ -8,7 +8,7 @@ import common.item.Item; import common.item.ItemControl; import common.item.ItemStack; import common.item.WieldType; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; import common.util.ExtMath; import common.util.Facing; @@ -23,16 +23,16 @@ public abstract class ItemWand extends Item { this.setTab(CheatTab.TOOLS); } - public final boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, BlockPos block) { + public final boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) { if(control == ItemControl.SECONDARY && !world.client && block == null) { - BlockPos vec = world.getBlockTrace(player, this.getRange(stack, player)); + LocalPos vec = world.getBlockTrace(player, this.getRange(stack, player)); if(vec != null) this.onUse(stack, player, (AWorldServer)world, new Vec3(ExtMath.floord(vec.getX()) + 0.5, ExtMath.floord(vec.getY()) + 1.0, ExtMath.floord(vec.getZ()) + 0.5)); } return control == ItemControl.SECONDARY; } - public final boolean onItemUse(ItemStack stack, EntityNPC player, World world, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { + public final boolean onItemUse(ItemStack stack, EntityNPC player, World world, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) { if(world.client) return true; if(pos != null) diff --git a/common/src/main/java/common/item/weapon/ItemArrow.java b/common/src/main/java/common/item/weapon/ItemArrow.java index f5f5e75f..113dcd2f 100644 --- a/common/src/main/java/common/item/weapon/ItemArrow.java +++ b/common/src/main/java/common/item/weapon/ItemArrow.java @@ -4,7 +4,7 @@ import common.entity.projectile.EntityArrow; import common.item.Item; import common.item.ItemStack; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Serverside; import common.util.Vec3; @@ -12,8 +12,8 @@ import common.world.AWorldServer; public class ItemArrow extends Item { @Serverside - public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - EntityArrow arrow = new EntityArrow(world, position.xCoord, position.yCoord, position.zCoord); + public ItemStack dispenseStack(AWorldServer world, TileEntity source, Vec3 position, LocalPos blockpos, Facing facing, ItemStack stack) { + EntityArrow arrow = new EntityArrow(world, position.x, position.y, position.z); arrow.canBePickedUp = 1; return this.dispenseProjectile(world, facing, stack, arrow); } diff --git a/common/src/main/java/common/item/weapon/ItemBanHammer.java b/common/src/main/java/common/item/weapon/ItemBanHammer.java index 9d73c692..70d6ff86 100755 --- a/common/src/main/java/common/item/weapon/ItemBanHammer.java +++ b/common/src/main/java/common/item/weapon/ItemBanHammer.java @@ -22,14 +22,14 @@ public class ItemBanHammer extends ItemWand { public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec) { List list = world.getEntitiesWithinAABB(EntityLiving.class, new BoundingBox( - vec.xCoord - 3.5, vec.yCoord - 3.5, vec.zCoord - 3.5, vec.xCoord + 3.5, vec.yCoord + 3.5, vec.zCoord + 3.5)); + vec.x - 3.5, vec.y - 3.5, vec.z - 3.5, vec.x + 3.5, vec.y + 3.5, vec.z + 3.5)); for(EntityLiving entity : list) { if(entity != player) entity.attackEntityFrom(DamageSource.causeExterminatusDamage(player), 1200); } for(int z = 0; z < 8; z++) { - world.strikeLightning(vec.xCoord - 0.5 + world.rand.drange(-2.5, 2.5), vec.yCoord, - vec.zCoord - 0.5 + world.rand.drange(-2.5, 2.5), 0x6f0000, 0, false, player); + world.strikeLightning(vec.x - 0.5 + world.rand.drange(-2.5, 2.5), vec.y, + vec.z - 0.5 + world.rand.drange(-2.5, 2.5), 0x6f0000, 0, false, player); } } diff --git a/common/src/main/java/common/item/weapon/ItemTrident.java b/common/src/main/java/common/item/weapon/ItemTrident.java index 89efff59..294e2ac5 100755 --- a/common/src/main/java/common/item/weapon/ItemTrident.java +++ b/common/src/main/java/common/item/weapon/ItemTrident.java @@ -18,7 +18,7 @@ public class ItemTrident extends ItemWand { public void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec) { if(player.useMana(5)) - world.strikeLightning(vec.xCoord - 0.5, vec.yCoord, vec.zCoord - 0.5, 0x532380, 230, true, player); + world.strikeLightning(vec.x - 0.5, vec.y, vec.z - 0.5, 0x532380, 230, true, player); } public int getRange(ItemStack stack, EntityNPC player) { diff --git a/common/src/main/java/common/network/IPlayer.java b/common/src/main/java/common/network/IPlayer.java index 2c9adde1..709b29f4 100644 --- a/common/src/main/java/common/network/IPlayer.java +++ b/common/src/main/java/common/network/IPlayer.java @@ -23,7 +23,7 @@ import common.packet.CPacketPlace; import common.packet.CPacketPlayer; import common.packet.CPacketSign; import common.packet.CPacketSkin; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.CharValidator; import common.util.ChunkPos; import common.util.PortalType; @@ -73,7 +73,7 @@ public interface IPlayer extends NetHandler { void addHotbar(String format, Object... args); void sendThrowMessage(ItemStack stack); void resetLastExperience(); - void travelToDimension(Dimension dimension, BlockPos pos, float yaw, float pitch, PortalType portal); + void travelToDimension(Dimension dimension, LocalPos pos, float yaw, float pitch, PortalType portal); void teleport(double x, double y, double z, float yaw, float pitch, Dimension dimension); void onItemPickup(Entity entity, int amount); void mountEntity(Entity entity); @@ -87,7 +87,7 @@ public interface IPlayer extends NetHandler { void updateEffectMeta(); void playSound(SoundEvent name, float volume); void updateEntity(); - void setSelection(boolean primary, BlockPos pos); + void setSelection(boolean primary, LocalPos pos); void setSelectMode(); void sendPacket(Packet packet); void setPlayerLocation(double x, double y, double z, float yaw, float pitch); diff --git a/common/src/main/java/common/network/PacketBuffer.java b/common/src/main/java/common/network/PacketBuffer.java index c68e702a..c3fed646 100755 --- a/common/src/main/java/common/network/PacketBuffer.java +++ b/common/src/main/java/common/network/PacketBuffer.java @@ -14,7 +14,7 @@ import common.net.buffer.ByteBufOutputStream; import common.net.handler.codec.DecoderException; import common.net.handler.codec.EncoderException; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; public class PacketBuffer { private static final Charset UTF_8 = Charset.forName("UTF-8"); @@ -44,14 +44,14 @@ public class PacketBuffer { return data; } - public void writeBlockPos(BlockPos pos) { + public void writeBlockPos(LocalPos pos) { this.writeInt(pos.getX()); this.writeInt(pos.getY()); this.writeInt(pos.getZ()); } - public BlockPos readBlockPos() { - return new BlockPos(this.readInt(), this.readInt(), this.readInt()); + public LocalPos readBlockPos() { + return new LocalPos(this.readInt(), this.readInt(), this.readInt()); } public void writeEnumValue(Enum value) { diff --git a/common/src/main/java/common/packet/CPacketBreak.java b/common/src/main/java/common/packet/CPacketBreak.java index 64dc2e49..f94f135f 100755 --- a/common/src/main/java/common/packet/CPacketBreak.java +++ b/common/src/main/java/common/packet/CPacketBreak.java @@ -5,12 +5,12 @@ import java.io.IOException; import common.network.IPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; public class CPacketBreak implements Packet { - private BlockPos position; + private LocalPos position; private Facing facing; private CPacketBreak.Action status; @@ -18,7 +18,7 @@ public class CPacketBreak implements Packet { } - public CPacketBreak(CPacketBreak.Action statusIn, BlockPos posIn, Facing facingIn) + public CPacketBreak(CPacketBreak.Action statusIn, LocalPos posIn, Facing facingIn) { this.status = statusIn; this.position = posIn; @@ -44,7 +44,7 @@ public class CPacketBreak implements Packet handler.processBreak(this); } - public BlockPos getPosition() + public LocalPos getPosition() { return this.position; } diff --git a/common/src/main/java/common/packet/CPacketComplete.java b/common/src/main/java/common/packet/CPacketComplete.java index 83fd0f00..c30a0ed9 100755 --- a/common/src/main/java/common/packet/CPacketComplete.java +++ b/common/src/main/java/common/packet/CPacketComplete.java @@ -5,19 +5,19 @@ import java.io.IOException; import common.network.IPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; public class CPacketComplete implements Packet { private String message; private int entityId; - private BlockPos position; + private LocalPos position; public CPacketComplete() { } - public CPacketComplete(String msg, int entity, BlockPos pos) + public CPacketComplete(String msg, int entity, LocalPos pos) { this.message = msg; this.entityId = entity; @@ -56,7 +56,7 @@ public class CPacketComplete implements Packet return this.entityId; } - public BlockPos getPosition() + public LocalPos getPosition() { return this.position; } diff --git a/common/src/main/java/common/packet/CPacketPlace.java b/common/src/main/java/common/packet/CPacketPlace.java index a2b8964c..adc304c2 100755 --- a/common/src/main/java/common/packet/CPacketPlace.java +++ b/common/src/main/java/common/packet/CPacketPlace.java @@ -6,13 +6,13 @@ import common.item.ItemStack; import common.network.IPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; public class CPacketPlace implements Packet { - private static final BlockPos DUMMY_POS = new BlockPos(-1, -1, -1); + private static final LocalPos DUMMY_POS = new LocalPos(-1, -1, -1); - private BlockPos position; + private LocalPos position; private int placedBlockDirection; private ItemStack stack; private float facingX; @@ -28,7 +28,7 @@ public class CPacketPlace implements Packet this(DUMMY_POS, 255, stackIn, 0.0F, 0.0F, 0.0F); } - public CPacketPlace(BlockPos positionIn, int placedBlockDirectionIn, ItemStack stackIn, float facingXIn, float facingYIn, float facingZIn) + public CPacketPlace(LocalPos positionIn, int placedBlockDirectionIn, ItemStack stackIn, float facingXIn, float facingYIn, float facingZIn) { this.position = positionIn; this.placedBlockDirection = placedBlockDirectionIn; @@ -63,7 +63,7 @@ public class CPacketPlace implements Packet handler.processPlace(this); } - public BlockPos getPosition() + public LocalPos getPosition() { return this.position; } diff --git a/common/src/main/java/common/packet/CPacketSign.java b/common/src/main/java/common/packet/CPacketSign.java index 9e014152..773c87e0 100755 --- a/common/src/main/java/common/packet/CPacketSign.java +++ b/common/src/main/java/common/packet/CPacketSign.java @@ -5,18 +5,18 @@ import java.io.IOException; import common.network.IPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; public class CPacketSign implements Packet { - private BlockPos pos; + private LocalPos pos; private String[] lines; public CPacketSign() { } - public CPacketSign(BlockPos pos, String[] lines) + public CPacketSign(LocalPos pos, String[] lines) { this.pos = pos; this.lines = new String[] { @@ -53,7 +53,7 @@ public class CPacketSign implements Packet handler.processSign(this); } - public BlockPos getPosition() + public LocalPos getPosition() { return this.pos; } diff --git a/common/src/main/java/common/packet/SPacketBlockChange.java b/common/src/main/java/common/packet/SPacketBlockChange.java index a4697f58..a2e58656 100755 --- a/common/src/main/java/common/packet/SPacketBlockChange.java +++ b/common/src/main/java/common/packet/SPacketBlockChange.java @@ -6,20 +6,20 @@ import common.init.BlockRegistry; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import common.world.World; public class SPacketBlockChange implements Packet { - private BlockPos blockPosition; + private LocalPos blockPosition; private State blockState; public SPacketBlockChange() { } - public SPacketBlockChange(World worldIn, BlockPos blockPositionIn) + public SPacketBlockChange(World worldIn, LocalPos blockPositionIn) { this.blockPosition = blockPositionIn; this.blockState = worldIn.getState(blockPositionIn); @@ -56,7 +56,7 @@ public class SPacketBlockChange implements Packet return this.blockState; } - public BlockPos getBlockPosition() + public LocalPos getBlockPosition() { return this.blockPosition; } diff --git a/common/src/main/java/common/packet/SPacketCharacterList.java b/common/src/main/java/common/packet/SPacketCharacterList.java index 08d53397..75044d73 100644 --- a/common/src/main/java/common/packet/SPacketCharacterList.java +++ b/common/src/main/java/common/packet/SPacketCharacterList.java @@ -12,7 +12,7 @@ import common.network.IClientPlayer; import common.network.IPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; public class SPacketCharacterList implements Packet { private final Map players = Maps.newHashMap(); @@ -52,7 +52,7 @@ public class SPacketCharacterList implements Packet { info = info.isEmpty() ? null : info; Alignment align = buf.readEnumValue(Alignment.class); String dim = buf.readString(1024); - BlockPos pos = buf.readBlockPos(); + LocalPos pos = buf.readBlockPos(); String type = buf.readString(256); int level = buf.readVarInt(); String origin = buf.readString(1024); diff --git a/common/src/main/java/common/packet/SPacketEffect.java b/common/src/main/java/common/packet/SPacketEffect.java index 9c81fb1a..bbb94f4a 100755 --- a/common/src/main/java/common/packet/SPacketEffect.java +++ b/common/src/main/java/common/packet/SPacketEffect.java @@ -5,17 +5,17 @@ import java.io.IOException; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; public class SPacketEffect implements Packet { private int soundType; - private BlockPos soundPos; + private LocalPos soundPos; private int soundData; public SPacketEffect() { } - public SPacketEffect(int soundTypeIn, BlockPos soundPosIn, int soundDataIn) { + public SPacketEffect(int soundTypeIn, LocalPos soundPosIn, int soundDataIn) { this.soundType = soundTypeIn; this.soundPos = soundPosIn; this.soundData = soundDataIn; @@ -45,7 +45,7 @@ public class SPacketEffect implements Packet { return this.soundData; } - public BlockPos getSoundPos() { + public LocalPos getSoundPos() { return this.soundPos; } } diff --git a/common/src/main/java/common/packet/SPacketExplosion.java b/common/src/main/java/common/packet/SPacketExplosion.java index 1c15d96d..3f17105b 100755 --- a/common/src/main/java/common/packet/SPacketExplosion.java +++ b/common/src/main/java/common/packet/SPacketExplosion.java @@ -11,28 +11,28 @@ import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; public class SPacketExplosion implements Packet { private double posX; private double posY; private double posZ; - private List blocks; + private List blocks; private boolean large; public SPacketExplosion() { } - public SPacketExplosion(double x, double y, double z, List blocks, boolean large) + public SPacketExplosion(double x, double y, double z, List blocks, boolean large) { this.posX = x; this.posY = y; this.posZ = z; this.large = large; if(blocks != null && blocks.size() > 256) { - Set pos = Sets.newHashSet(); + Set pos = Sets.newHashSet(); Random rand = new Random(); for(int n = 0; n < 256; n++) { pos.add(rand.pick(blocks)); @@ -52,7 +52,7 @@ public class SPacketExplosion implements Packet this.posZ = (double)buf.readFloat(); int i = buf.readInt(); if(i > 0) { - this.blocks = new ArrayList(i); + this.blocks = new ArrayList(i); int j = (int)this.posX; int k = (int)this.posY; int l = (int)this.posZ; @@ -62,7 +62,7 @@ public class SPacketExplosion implements Packet int j1 = buf.readShort() + j; int k1 = buf.readShort() + k; int l1 = buf.readShort() + l; - this.blocks.add(new BlockPos(j1, k1, l1)); + this.blocks.add(new LocalPos(j1, k1, l1)); } } @@ -80,7 +80,7 @@ public class SPacketExplosion implements Packet int j = (int)this.posY; int k = (int)this.posZ; - for (BlockPos blockpos : this.blocks) + for (LocalPos blockpos : this.blocks) { int l = blockpos.getX() - i; int i1 = blockpos.getY() - j; @@ -119,7 +119,7 @@ public class SPacketExplosion implements Packet return this.large; } - public List getBlocks() + public List getBlocks() { return this.blocks; } diff --git a/common/src/main/java/common/packet/SPacketMultiBlockChange.java b/common/src/main/java/common/packet/SPacketMultiBlockChange.java index 5e907340..86dcbd2c 100755 --- a/common/src/main/java/common/packet/SPacketMultiBlockChange.java +++ b/common/src/main/java/common/packet/SPacketMultiBlockChange.java @@ -6,7 +6,7 @@ import common.init.BlockRegistry; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ChunkPos; import common.world.State; @@ -15,9 +15,9 @@ public class SPacketMultiBlockChange implements Packet private ChunkPos chunkPosCoord; private SPacketMultiBlockChange.BlockUpdateData[] changedBlocks; - public static BlockPos getPos(ChunkPos pos, long position) + public static LocalPos getPos(ChunkPos pos, long position) { - return new BlockPos(new BlockPos((pos.x << 4) + (int)(position >> 36 & 15L), (int)(position & 4294967295L), (pos.z << 4) + (int)(position >> 32 & 15L))); + return new LocalPos(new LocalPos((pos.x << 4) + (int)(position >> 36 & 15L), (int)(position & 4294967295L), (pos.z << 4) + (int)(position >> 32 & 15L))); } public SPacketMultiBlockChange() diff --git a/common/src/main/java/common/packet/SPacketOpenWindow.java b/common/src/main/java/common/packet/SPacketOpenWindow.java index eb907d32..66e620c2 100755 --- a/common/src/main/java/common/packet/SPacketOpenWindow.java +++ b/common/src/main/java/common/packet/SPacketOpenWindow.java @@ -8,7 +8,7 @@ import common.init.Blocks; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; public class SPacketOpenWindow implements Packet @@ -17,7 +17,7 @@ public class SPacketOpenWindow implements Packet private Block type; private int slotCount; private int entityId = -1; - private BlockPos tilePos; + private LocalPos tilePos; public SPacketOpenWindow() { @@ -36,7 +36,7 @@ public class SPacketOpenWindow implements Packet this.entityId = incomingEntityId; } - public SPacketOpenWindow(int windowIdIn, BlockPos incomingTilePos, int slotCountIn) + public SPacketOpenWindow(int windowIdIn, LocalPos incomingTilePos, int slotCountIn) { this(windowIdIn, (Block)null, slotCountIn); this.tilePos = incomingTilePos; @@ -93,7 +93,7 @@ public class SPacketOpenWindow implements Packet return this.entityId; } - public BlockPos getTilePos() + public LocalPos getTilePos() { return this.tilePos; } diff --git a/common/src/main/java/common/packet/SPacketSignEditorOpen.java b/common/src/main/java/common/packet/SPacketSignEditorOpen.java index b7b09e92..9d7f615b 100755 --- a/common/src/main/java/common/packet/SPacketSignEditorOpen.java +++ b/common/src/main/java/common/packet/SPacketSignEditorOpen.java @@ -5,17 +5,17 @@ import java.io.IOException; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; public class SPacketSignEditorOpen implements Packet { - private BlockPos signPosition; + private LocalPos signPosition; public SPacketSignEditorOpen() { } - public SPacketSignEditorOpen(BlockPos signPositionIn) + public SPacketSignEditorOpen(LocalPos signPositionIn) { this.signPosition = signPositionIn; } @@ -44,7 +44,7 @@ public class SPacketSignEditorOpen implements Packet buf.writeBlockPos(this.signPosition); } - public BlockPos getSignPosition() + public LocalPos getSignPosition() { return this.signPosition; } diff --git a/common/src/main/java/common/packet/SPacketSpawnObject.java b/common/src/main/java/common/packet/SPacketSpawnObject.java index 6ae2456e..46b7b93f 100755 --- a/common/src/main/java/common/packet/SPacketSpawnObject.java +++ b/common/src/main/java/common/packet/SPacketSpawnObject.java @@ -10,7 +10,7 @@ import common.init.EntityRegistry; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Vec3; @@ -40,7 +40,7 @@ public class SPacketSpawnObject implements Packet if(entityIn instanceof IObjectData) data = ((IObjectData)entityIn).getPacketData(); if(entityIn instanceof EntityLeashKnot) { - BlockPos pos = ((EntityLeashKnot)entityIn).getHangingPosition(); + LocalPos pos = ((EntityLeashKnot)entityIn).getHangingPosition(); this.x = ExtMath.floorf((float)(pos.getX() * 32)); this.y = ExtMath.floorf((float)(pos.getY() * 32)); this.z = ExtMath.floorf((float)(pos.getZ() * 32)); @@ -56,9 +56,9 @@ public class SPacketSpawnObject implements Packet this.data = data; if(entityIn instanceof EntityProjectile) { Vec3 accel = ((EntityProjectile)entityIn).getAcceleration(); - this.speedX = (int)(accel.xCoord * 8000.0D); - this.speedY = (int)(accel.yCoord * 8000.0D); - this.speedZ = (int)(accel.zCoord * 8000.0D); + this.speedX = (int)(accel.x * 8000.0D); + this.speedY = (int)(accel.y * 8000.0D); + this.speedZ = (int)(accel.z * 8000.0D); this.hasSpeed = true; } else if(entityIn.hasSpawnVelocity()) { diff --git a/common/src/main/java/common/packet/SPacketUpdateDevice.java b/common/src/main/java/common/packet/SPacketUpdateDevice.java index 69c2f0be..4a9709a0 100755 --- a/common/src/main/java/common/packet/SPacketUpdateDevice.java +++ b/common/src/main/java/common/packet/SPacketUpdateDevice.java @@ -9,11 +9,11 @@ import common.network.Packet; import common.network.PacketBuffer; import common.tags.TagObject; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; public class SPacketUpdateDevice implements Packet { - private BlockPos position; + private LocalPos position; private Block type; private TagObject tag; @@ -43,7 +43,7 @@ public class SPacketUpdateDevice implements Packet { handler.handleUpdateDevice(this); } - public BlockPos getPos() { + public LocalPos getPos() { return this.position; } diff --git a/common/src/main/java/common/packet/SPacketUpdateDisplay.java b/common/src/main/java/common/packet/SPacketUpdateDisplay.java index bedf6f4f..bfd0bf42 100644 --- a/common/src/main/java/common/packet/SPacketUpdateDisplay.java +++ b/common/src/main/java/common/packet/SPacketUpdateDisplay.java @@ -6,17 +6,17 @@ import common.net.handler.codec.DecoderException; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; public class SPacketUpdateDisplay implements Packet { private int density; - private BlockPos position; + private LocalPos position; private int[] pixels; public SPacketUpdateDisplay() { } - public SPacketUpdateDisplay(int density, BlockPos pos, int[] pixels) { + public SPacketUpdateDisplay(int density, LocalPos pos, int[] pixels) { this.density = density; this.position = pos; this.pixels = pixels; @@ -49,7 +49,7 @@ public class SPacketUpdateDisplay implements Packet { handler.handleUpdateDisplay(this); } - public BlockPos getPos() { + public LocalPos getPos() { return this.position; } diff --git a/common/src/main/java/common/packet/SPacketUpdatePipe.java b/common/src/main/java/common/packet/SPacketUpdatePipe.java index c13d6973..90b4addd 100644 --- a/common/src/main/java/common/packet/SPacketUpdatePipe.java +++ b/common/src/main/java/common/packet/SPacketUpdatePipe.java @@ -7,10 +7,10 @@ import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; import common.tileentity.TileEntityItemPipe; -import common.util.BlockPos; +import common.util.LocalPos; public class SPacketUpdatePipe implements Packet { - private BlockPos position; + private LocalPos position; private ItemStack item; public SPacketUpdatePipe() { @@ -35,7 +35,7 @@ public class SPacketUpdatePipe implements Packet { handler.handleUpdatePipe(this); } - public BlockPos getPos() { + public LocalPos getPos() { return this.position; } diff --git a/common/src/main/java/common/packet/SPacketUpdateSign.java b/common/src/main/java/common/packet/SPacketUpdateSign.java index 4553d0b6..0cb3d0a0 100755 --- a/common/src/main/java/common/packet/SPacketUpdateSign.java +++ b/common/src/main/java/common/packet/SPacketUpdateSign.java @@ -5,18 +5,18 @@ import java.io.IOException; import common.network.IClientPlayer; import common.network.Packet; import common.network.PacketBuffer; -import common.util.BlockPos; +import common.util.LocalPos; public class SPacketUpdateSign implements Packet { - private BlockPos blockPos; + private LocalPos blockPos; private String[] lines; public SPacketUpdateSign() { } - public SPacketUpdateSign(BlockPos blockPosIn, String[] linesIn) + public SPacketUpdateSign(LocalPos blockPosIn, String[] linesIn) { this.blockPos = blockPosIn; this.lines = new String[] {linesIn[0], linesIn[1], linesIn[2], linesIn[3]}; @@ -57,7 +57,7 @@ public class SPacketUpdateSign implements Packet handler.handleUpdateSign(this); } - public BlockPos getPos() + public LocalPos getPos() { return this.blockPos; } diff --git a/common/src/main/java/common/pathfinding/PathCache.java b/common/src/main/java/common/pathfinding/PathCache.java index b33d97be..1e882e63 100755 --- a/common/src/main/java/common/pathfinding/PathCache.java +++ b/common/src/main/java/common/pathfinding/PathCache.java @@ -1,7 +1,7 @@ package common.pathfinding; import common.init.Blocks; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.Chunk; import common.world.IBlockAccess; import common.world.State; @@ -13,7 +13,7 @@ public class PathCache implements IBlockAccess protected final int chunkZ; protected final Chunk[][] data; - public PathCache(World world, BlockPos pos1, BlockPos pos2) + public PathCache(World world, LocalPos pos1, LocalPos pos2) { this.chunkX = pos1.getX() >> 4; this.chunkZ = pos1.getZ() >> 4; @@ -29,7 +29,7 @@ public class PathCache implements IBlockAccess } } - public State getState(BlockPos pos) + public State getState(LocalPos pos) { if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { diff --git a/common/src/main/java/common/pathfinding/PathEntity.java b/common/src/main/java/common/pathfinding/PathEntity.java index 85f8e74c..d1608073 100755 --- a/common/src/main/java/common/pathfinding/PathEntity.java +++ b/common/src/main/java/common/pathfinding/PathEntity.java @@ -124,6 +124,6 @@ public class PathEntity public boolean isDestinationSame(Vec3 vec) { PathPoint pathpoint = this.getFinalPathPoint(); - return pathpoint == null ? false : pathpoint.xCoord == (int)vec.xCoord && pathpoint.zCoord == (int)vec.zCoord; + return pathpoint == null ? false : pathpoint.xCoord == (int)vec.x && pathpoint.zCoord == (int)vec.z; } } diff --git a/common/src/main/java/common/pathfinding/PathFinder.java b/common/src/main/java/common/pathfinding/PathFinder.java index 52b4569c..e13f8c0e 100755 --- a/common/src/main/java/common/pathfinding/PathFinder.java +++ b/common/src/main/java/common/pathfinding/PathFinder.java @@ -1,7 +1,7 @@ package common.pathfinding; import common.entity.Entity; -import common.util.BlockPos; +import common.util.LocalPos; public class PathFinder { @@ -28,7 +28,7 @@ public class PathFinder /** * Creates a path from an entity to a specified location within a minimum distance */ - public PathEntity createEntityPathTo(PathCache blockaccess, Entity entityIn, BlockPos targetPos, float dist) + public PathEntity createEntityPathTo(PathCache blockaccess, Entity entityIn, LocalPos targetPos, float dist) { return this.createEntityPathTo(blockaccess, entityIn, (double)((float)targetPos.getX() + 0.5F), (double)((float)targetPos.getY() + 0.5F), (double)((float)targetPos.getZ() + 0.5F), dist); } diff --git a/common/src/main/java/common/pathfinding/PathNavigate.java b/common/src/main/java/common/pathfinding/PathNavigate.java index 7b0993ac..2537a41c 100755 --- a/common/src/main/java/common/pathfinding/PathNavigate.java +++ b/common/src/main/java/common/pathfinding/PathNavigate.java @@ -4,7 +4,7 @@ import java.util.List; import common.entity.Entity; import common.entity.types.EntityLiving; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ExtMath; import common.util.Vec3; @@ -64,13 +64,13 @@ public abstract class PathNavigate */ public final PathEntity getPathToXYZ(double x, double y, double z) { - return this.getPathToPos(new BlockPos(ExtMath.floord(x), (int)y, ExtMath.floord(z))); + return this.getPathToPos(new LocalPos(ExtMath.floord(x), (int)y, ExtMath.floord(z))); } /** * Returns path to given BlockPos */ - public PathEntity getPathToPos(BlockPos pos) + public PathEntity getPathToPos(LocalPos pos) { if (!this.canNavigate()) { @@ -80,7 +80,7 @@ public abstract class PathNavigate { float f = this.getPathSearchRange(); // this.worldObj.profiler.start("pathfind"); - BlockPos blockpos = new BlockPos(this.theEntity); + LocalPos blockpos = new LocalPos(this.theEntity); int i = (int)(f + 8.0F); PathCache chunkcache = new PathCache(this.worldObj, blockpos.add(-i, -i, -i), blockpos.add(i, i, i)); PathEntity pathentity = this.pathFinder.createEntityPathTo(chunkcache, this.theEntity, pos, f); @@ -119,7 +119,7 @@ public abstract class PathNavigate { float f = this.getPathSearchRange(); // this.worldObj.profiler.start("pathfind"); - BlockPos blockpos = (new BlockPos(this.theEntity)).up(); + LocalPos blockpos = (new LocalPos(this.theEntity)).up(); int i = (int)(f + 16.0F); PathCache chunkcache = new PathCache(this.worldObj, blockpos.add(-i, -i, -i), blockpos.add(i, i, i)); PathEntity pathentity = this.pathFinder.createEntityPathTo(chunkcache, this.theEntity, entityIn, f); @@ -195,7 +195,7 @@ public abstract class PathNavigate Vec3 vec3 = this.getEntityPosition(); Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex()); - if (vec3.yCoord > vec31.yCoord && !this.theEntity.onGround && ExtMath.floord(vec3.xCoord) == ExtMath.floord(vec31.xCoord) && ExtMath.floord(vec3.zCoord) == ExtMath.floord(vec31.zCoord)) + if (vec3.y > vec31.y && !this.theEntity.onGround && ExtMath.floord(vec3.x) == ExtMath.floord(vec31.x) && ExtMath.floord(vec3.z) == ExtMath.floord(vec31.z)) { this.currentPath.setCurrentPathIndex(this.currentPath.getCurrentPathIndex() + 1); } @@ -207,7 +207,7 @@ public abstract class PathNavigate if (vec32 != null) { - BoundingBox axisalignedbb1 = (new BoundingBox(vec32.xCoord, vec32.yCoord, vec32.zCoord, vec32.xCoord, vec32.yCoord, vec32.zCoord)).expand(0.5D, 0.5D, 0.5D); + BoundingBox axisalignedbb1 = (new BoundingBox(vec32.x, vec32.y, vec32.z, vec32.x, vec32.y, vec32.z)).expand(0.5D, 0.5D, 0.5D); List list = this.worldObj.getCollidingBoundingBoxes(this.theEntity, axisalignedbb1.addCoord(0.0D, -1.0D, 0.0D)); double d0 = -1.0D; axisalignedbb1 = axisalignedbb1.offset(0.0D, 1.0D, 0.0D); @@ -217,7 +217,7 @@ public abstract class PathNavigate d0 = axisalignedbb.calculateYOffset(axisalignedbb1, d0); } - this.theEntity.getMoveHelper().setMoveTo(vec32.xCoord, vec32.yCoord + d0, vec32.zCoord, this.speed); + this.theEntity.getMoveHelper().setMoveTo(vec32.x, vec32.y + d0, vec32.z, this.speed); } } } @@ -230,7 +230,7 @@ public abstract class PathNavigate for (int j = this.currentPath.getCurrentPathIndex(); j < this.currentPath.getCurrentPathLength(); ++j) { - if (this.currentPath.getPathPointFromIndex(j).yCoord != (int)vec3.yCoord) + if (this.currentPath.getPathPointFromIndex(j).yCoord != (int)vec3.y) { i = j; break; @@ -243,7 +243,7 @@ public abstract class PathNavigate { Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, k); - if (vec3.squareDistanceTo(vec31) < (double)f) + if (vec3.distanceSq(vec31) < (double)f) { this.currentPath.setCurrentPathIndex(k + 1); } @@ -273,7 +273,7 @@ public abstract class PathNavigate { if (this.totalTicks - this.ticksAtLastPos > 100) { - if (positionVec3.squareDistanceTo(this.lastPosCheck) < 2.25D) + if (positionVec3.distanceSq(this.lastPosCheck) < 2.25D) { this.clearPathEntity(); } diff --git a/common/src/main/java/common/pathfinding/PathNavigateClimber.java b/common/src/main/java/common/pathfinding/PathNavigateClimber.java index 0632fe26..9e6be133 100755 --- a/common/src/main/java/common/pathfinding/PathNavigateClimber.java +++ b/common/src/main/java/common/pathfinding/PathNavigateClimber.java @@ -2,14 +2,14 @@ package common.pathfinding; import common.entity.Entity; import common.entity.types.EntityLiving; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.world.World; public class PathNavigateClimber extends PathNavigateGround { /** Current path navigation target */ - private BlockPos targetPosition; + private LocalPos targetPosition; public PathNavigateClimber(EntityLiving entityLivingIn, World worldIn) { @@ -19,7 +19,7 @@ public class PathNavigateClimber extends PathNavigateGround /** * Returns path to given BlockPos */ - public PathEntity getPathToPos(BlockPos pos) + public PathEntity getPathToPos(LocalPos pos) { this.targetPosition = pos; return super.getPathToPos(pos); @@ -30,7 +30,7 @@ public class PathNavigateClimber extends PathNavigateGround */ public PathEntity getPathToEntityLiving(Entity entityIn) { - this.targetPosition = new BlockPos(entityIn); + this.targetPosition = new LocalPos(entityIn); return super.getPathToEntityLiving(entityIn); } @@ -47,7 +47,7 @@ public class PathNavigateClimber extends PathNavigateGround } else { - this.targetPosition = new BlockPos(entityIn); + this.targetPosition = new LocalPos(entityIn); this.speed = speedIn; return true; } @@ -65,7 +65,7 @@ public class PathNavigateClimber extends PathNavigateGround { double d0 = (double)(this.theEntity.width * this.theEntity.width); - if (this.theEntity.getDistanceSqToCenter(this.targetPosition) >= d0 && (this.theEntity.posY <= (double)this.targetPosition.getY() || this.theEntity.getDistanceSqToCenter(new BlockPos(this.targetPosition.getX(), ExtMath.floord(this.theEntity.posY), this.targetPosition.getZ())) >= d0)) + if (this.theEntity.getDistanceSqToCenter(this.targetPosition) >= d0 && (this.theEntity.posY <= (double)this.targetPosition.getY() || this.theEntity.getDistanceSqToCenter(new LocalPos(this.targetPosition.getX(), ExtMath.floord(this.theEntity.posY), this.targetPosition.getZ())) >= d0)) { this.theEntity.getMoveHelper().setMoveTo((double)this.targetPosition.getX(), (double)this.targetPosition.getY(), (double)this.targetPosition.getZ(), this.speed); } diff --git a/common/src/main/java/common/pathfinding/PathNavigateGround.java b/common/src/main/java/common/pathfinding/PathNavigateGround.java index de0767c3..f2e6ca08 100755 --- a/common/src/main/java/common/pathfinding/PathNavigateGround.java +++ b/common/src/main/java/common/pathfinding/PathNavigateGround.java @@ -6,7 +6,7 @@ import common.entity.animal.EntityChicken; import common.entity.npc.EntityZombie; import common.entity.types.EntityLiving; import common.init.Blocks; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Vec3; import common.world.World; @@ -48,13 +48,13 @@ public class PathNavigateGround extends PathNavigate if (this.theEntity.isInLiquid() && this.getCanSwim()) { int i = (int)this.theEntity.getEntityBoundingBox().minY; - Block block = this.worldObj.getState(new BlockPos(ExtMath.floord(this.theEntity.posX), i, ExtMath.floord(this.theEntity.posZ))).getBlock(); + Block block = this.worldObj.getState(new LocalPos(ExtMath.floord(this.theEntity.posX), i, ExtMath.floord(this.theEntity.posZ))).getBlock(); int j = 0; while (block.getMaterial().isColdLiquid()) { ++i; - block = this.worldObj.getState(new BlockPos(ExtMath.floord(this.theEntity.posX), i, ExtMath.floord(this.theEntity.posZ))).getBlock(); + block = this.worldObj.getState(new LocalPos(ExtMath.floord(this.theEntity.posX), i, ExtMath.floord(this.theEntity.posZ))).getBlock(); ++j; if (j > 16) @@ -77,10 +77,10 @@ public class PathNavigateGround extends PathNavigate */ protected boolean isDirectPathBetweenPoints(Vec3 posVec31, Vec3 posVec32, int sizeX, int sizeY, int sizeZ) { - int i = ExtMath.floord(posVec31.xCoord); - int j = ExtMath.floord(posVec31.zCoord); - double d0 = posVec32.xCoord - posVec31.xCoord; - double d1 = posVec32.zCoord - posVec31.zCoord; + int i = ExtMath.floord(posVec31.x); + int j = ExtMath.floord(posVec31.z); + double d0 = posVec32.x - posVec31.x; + double d1 = posVec32.z - posVec31.z; double d2 = d0 * d0 + d1 * d1; if (d2 < 1.0E-8D) @@ -95,7 +95,7 @@ public class PathNavigateGround extends PathNavigate sizeX = sizeX + 2; sizeZ = sizeZ + 2; - if (!this.isSafeToStandAt(i, (int)posVec31.yCoord, j, sizeX, sizeY, sizeZ, posVec31, d0, d1)) + if (!this.isSafeToStandAt(i, (int)posVec31.y, j, sizeX, sizeY, sizeZ, posVec31, d0, d1)) { return false; } @@ -105,8 +105,8 @@ public class PathNavigateGround extends PathNavigate sizeZ = sizeZ - 2; double d4 = 1.0D / Math.abs(d0); double d5 = 1.0D / Math.abs(d1); - double d6 = (double)(i * 1) - posVec31.xCoord; - double d7 = (double)(j * 1) - posVec31.zCoord; + double d6 = (double)(i * 1) - posVec31.x; + double d7 = (double)(j * 1) - posVec31.z; if (d0 >= 0.0D) { @@ -122,8 +122,8 @@ public class PathNavigateGround extends PathNavigate d7 = d7 / d1; int k = d0 < 0.0D ? -1 : 1; int l = d1 < 0.0D ? -1 : 1; - int i1 = ExtMath.floord(posVec32.xCoord); - int j1 = ExtMath.floord(posVec32.zCoord); + int i1 = ExtMath.floord(posVec32.x); + int j1 = ExtMath.floord(posVec32.z); int k1 = i1 - i; int l1 = j1 - j; @@ -142,7 +142,7 @@ public class PathNavigateGround extends PathNavigate l1 = j1 - j; } - if (!this.isSafeToStandAt(i, (int)posVec31.yCoord, j, sizeX, sizeY, sizeZ, posVec31, d0, d1)) + if (!this.isSafeToStandAt(i, (int)posVec31.y, j, sizeX, sizeY, sizeZ, posVec31, d0, d1)) { return false; } @@ -171,12 +171,12 @@ public class PathNavigateGround extends PathNavigate { for (int l = j; l < j + sizeZ; ++l) { - double d0 = (double)k + 0.5D - vec31.xCoord; - double d1 = (double)l + 0.5D - vec31.zCoord; + double d0 = (double)k + 0.5D - vec31.x; + double d1 = (double)l + 0.5D - vec31.z; if (d0 * p_179683_8_ + d1 * p_179683_10_ >= 0.0D) { - Block block = this.worldObj.getState(new BlockPos(k, y - 1, l)).getBlock(); + Block block = this.worldObj.getState(new LocalPos(k, y - 1, l)).getBlock(); Material material = block.getMaterial(); if (block == Blocks.air) @@ -206,10 +206,10 @@ public class PathNavigateGround extends PathNavigate */ private boolean isPositionClear(int p_179692_1_, int p_179692_2_, int p_179692_3_, int p_179692_4_, int p_179692_5_, int p_179692_6_, Vec3 p_179692_7_, double p_179692_8_, double p_179692_10_) { - for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(p_179692_1_, p_179692_2_, p_179692_3_), new BlockPos(p_179692_1_ + p_179692_4_ - 1, p_179692_2_ + p_179692_5_ - 1, p_179692_3_ + p_179692_6_ - 1))) + for (LocalPos blockpos : LocalPos.area(new LocalPos(p_179692_1_, p_179692_2_, p_179692_3_), new LocalPos(p_179692_1_ + p_179692_4_ - 1, p_179692_2_ + p_179692_5_ - 1, p_179692_3_ + p_179692_6_ - 1))) { - double d0 = (double)blockpos.getX() + 0.5D - p_179692_7_.xCoord; - double d1 = (double)blockpos.getZ() + 0.5D - p_179692_7_.zCoord; + double d0 = (double)blockpos.getX() + 0.5D - p_179692_7_.x; + double d1 = (double)blockpos.getZ() + 0.5D - p_179692_7_.z; if (d0 * p_179692_8_ + d1 * p_179692_10_ >= 0.0D) { diff --git a/common/src/main/java/common/pathfinding/SwimNodeProcessor.java b/common/src/main/java/common/pathfinding/SwimNodeProcessor.java index cebffbbe..313c6da1 100755 --- a/common/src/main/java/common/pathfinding/SwimNodeProcessor.java +++ b/common/src/main/java/common/pathfinding/SwimNodeProcessor.java @@ -2,9 +2,9 @@ package common.pathfinding; import common.block.Block; import common.entity.Entity; -import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; +import common.util.MutablePos; public class SwimNodeProcessor extends NodeProcessor { @@ -67,7 +67,7 @@ public class SwimNodeProcessor extends NodeProcessor private int findNonLiquid(Entity entityIn, int x, int y, int z) { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int i = x; i < x + this.entitySizeX; ++i) { diff --git a/common/src/main/java/common/pathfinding/WalkNodeProcessor.java b/common/src/main/java/common/pathfinding/WalkNodeProcessor.java index 1bee0089..4a85a548 100755 --- a/common/src/main/java/common/pathfinding/WalkNodeProcessor.java +++ b/common/src/main/java/common/pathfinding/WalkNodeProcessor.java @@ -9,8 +9,9 @@ import common.block.artificial.BlockWall; import common.block.tech.BlockRail; import common.entity.Entity; import common.init.Blocks; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; +import common.util.MutablePos; import common.world.IBlockAccess; public class WalkNodeProcessor extends NodeProcessor @@ -48,7 +49,7 @@ public class WalkNodeProcessor extends NodeProcessor if (this.canSwim && entityIn.isInLiquid()) { i = (int)entityIn.getEntityBoundingBox().minY; - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(ExtMath.floord(entityIn.posX), i, ExtMath.floord(entityIn.posZ)); + MutablePos blockpos$mutableblockpos = new MutablePos(ExtMath.floord(entityIn.posX), i, ExtMath.floord(entityIn.posZ)); for (Block block = this.blockaccess.getState(blockpos$mutableblockpos).getBlock(); block.getMaterial().isColdLiquid(); block = this.blockaccess.getState(blockpos$mutableblockpos).getBlock()) { @@ -193,8 +194,8 @@ public class WalkNodeProcessor extends NodeProcessor public static int getColliding(IBlockAccess world, Entity entity, int x, int y, int z, int sizeX, int sizeY, int sizeZ, boolean avoidWater, boolean breakDoors, boolean enterDoors) { boolean flag = false; - BlockPos blockpos = new BlockPos(entity); - BlockPos.MutableBlockPos mpos = new BlockPos.MutableBlockPos(); + LocalPos blockpos = new LocalPos(entity); + MutablePos mpos = new MutablePos(); for (int i = x; i < x + sizeX; ++i) { diff --git a/common/src/main/java/common/tileentity/DeviceDispenser.java b/common/src/main/java/common/tileentity/DeviceDispenser.java index 1ab14891..c32d8053 100755 --- a/common/src/main/java/common/tileentity/DeviceDispenser.java +++ b/common/src/main/java/common/tileentity/DeviceDispenser.java @@ -5,7 +5,7 @@ import common.item.ItemStack; import common.rng.Random; import common.tags.TagObject; import common.tileentity.MachineResource.Type; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.vars.Vars; import common.world.AWorldServer; @@ -41,7 +41,7 @@ public class DeviceDispenser extends Device { compound.setInt("Cooldown", this.cooldown); } - private ItemStack dispenseStack(ItemStack stack, AWorldServer world, BlockPos pos) { + private ItemStack dispenseStack(ItemStack stack, AWorldServer world, LocalPos pos) { Facing facing = world.getState(pos).getValue(BlockDispenser.FACING); if(this.dropItems) { BlockDispenser.dispense(world, 6.0, facing, BlockDispenser.getDispensePosition(pos, facing), stack.split(1)); diff --git a/common/src/main/java/common/tileentity/TileEntity.java b/common/src/main/java/common/tileentity/TileEntity.java index 5f6edbd4..86521ce2 100755 --- a/common/src/main/java/common/tileentity/TileEntity.java +++ b/common/src/main/java/common/tileentity/TileEntity.java @@ -6,7 +6,7 @@ import common.init.BlockRegistry; import common.log.Log; import common.network.Packet; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.AWorldServer; import common.world.Chunk; import common.world.State; @@ -20,12 +20,12 @@ public abstract class TileEntity { } protected World world; - protected BlockPos pos = BlockPos.ORIGIN; + protected LocalPos pos = LocalPos.ORIGIN; private boolean invalid; private State state = null; private Block block = null; - public static TileEntity createTile(AWorldServer world, Chunk chunk, BlockPos pos, TagObject tag) { + public static TileEntity createTile(AWorldServer world, Chunk chunk, LocalPos pos, TagObject tag) { Block block = chunk.getState(pos).getBlock(); if(!(block instanceof ITileEntityProvider provider)) { Log.TICK.warn("Ignoriere Block-Objekt von unbekanntem Block %s in Chunk %d, %d", BlockRegistry.getName(block), chunk.xPos, chunk.zPos); @@ -72,7 +72,7 @@ public abstract class TileEntity { return dx * dx + dy * dy + dz * dz; } - public final BlockPos getPos() { + public final LocalPos getPos() { return this.pos; } @@ -106,7 +106,7 @@ public abstract class TileEntity { this.state = null; } - public final void setPos(BlockPos posIn) { + public final void setPos(LocalPos posIn) { this.pos = posIn; } diff --git a/common/src/main/java/common/tileentity/TileEntityItemPipe.java b/common/src/main/java/common/tileentity/TileEntityItemPipe.java index 8cf545c7..e6c17859 100755 --- a/common/src/main/java/common/tileentity/TileEntityItemPipe.java +++ b/common/src/main/java/common/tileentity/TileEntityItemPipe.java @@ -16,7 +16,7 @@ import common.item.ItemStack; import common.network.Packet; import common.packet.SPacketUpdatePipe; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.Facing; import common.util.Serverside; @@ -131,7 +131,7 @@ public class TileEntityItemPipe extends TileEntity implements IInventory, ITicka if(this.getState().getBlock() instanceof BlockPipe) { boolean changed = false; if(this.suction > 1) { - BlockPos pos = this.pos.offset(this.getState().getValue(BlockPipe.FACING)); + LocalPos pos = this.pos.offset(this.getState().getValue(BlockPipe.FACING)); if(this.world.getState(pos).getBlock() instanceof ITileEntityProvider) { TileEntity te = this.world.getTileEntity(pos); if(te instanceof TileEntityItemPipe pipe) @@ -307,7 +307,7 @@ public class TileEntityItemPipe extends TileEntity implements IInventory, ITicka State state = this.getState(); Facing facing = state.getValue(BlockPipe.FACING); for(Facing dir : Facing.values()) { - BlockPos pos = this.pos.offset(dir); + LocalPos pos = this.pos.offset(dir); IInventory inv = (this.suck ? dir == facing.getOpposite() : dir != facing) ? this.getInventory(pos, false, this.suck) : null; if(inv != null) { Facing opposite = dir.getOpposite(); @@ -412,7 +412,7 @@ public class TileEntityItemPipe extends TileEntity implements IInventory, ITicka return stack; } - private IInventory getInventory(BlockPos pos, boolean pipe, boolean suck) { + private IInventory getInventory(LocalPos pos, boolean pipe, boolean suck) { IInventory inv = null; Block block = this.world.getState(pos).getBlock(); if(block instanceof ITileEntityProvider) { diff --git a/common/src/main/java/common/util/BlockPos.java b/common/src/main/java/common/util/BlockPos.java deleted file mode 100755 index 526a1f48..00000000 --- a/common/src/main/java/common/util/BlockPos.java +++ /dev/null @@ -1,339 +0,0 @@ -package common.util; - -import java.util.Iterator; - -import common.collect.AbstractIterator; -import common.entity.Entity; - -public class BlockPos extends Vec3i -{ - public static final BlockPos ORIGIN = new BlockPos(0, 0, 0); - - public BlockPos(int x, int y, int z) - { - super(x, y, z); - } - - public BlockPos(double x, double y, double z) - { - super(x, y, z); - } - - public BlockPos(Entity source) - { - this(source.posX, source.posY, source.posZ); - } - - public BlockPos(Vec3 source) - { - this(source.xCoord, source.yCoord, source.zCoord); - } - - public BlockPos(Vec3i source) - { - this(source.getX(), source.getY(), source.getZ()); - } - - /** - * Add the given coordinates to the coordinates of this BlockPos - */ - public BlockPos add(double x, double y, double z) - { - return x == 0.0D && y == 0.0D && z == 0.0D ? this : new BlockPos((double)this.getX() + x, (double)this.getY() + y, (double)this.getZ() + z); - } - - /** - * Add the given coordinates to the coordinates of this BlockPos - */ - public BlockPos add(int x, int y, int z) - { - return x == 0 && y == 0 && z == 0 ? this : new BlockPos(this.getX() + x, this.getY() + y, this.getZ() + z); - } - - /** - * Add the given Vector to this BlockPos - */ - public BlockPos add(Vec3i vec) - { - return vec.getX() == 0 && vec.getY() == 0 && vec.getZ() == 0 ? this : new BlockPos(this.getX() + vec.getX(), this.getY() + vec.getY(), this.getZ() + vec.getZ()); - } - - /** - * Subtract the given Vector from this BlockPos - */ - public BlockPos subtract(Vec3i vec) - { - return vec.getX() == 0 && vec.getY() == 0 && vec.getZ() == 0 ? this : new BlockPos(this.getX() - vec.getX(), this.getY() - vec.getY(), this.getZ() - vec.getZ()); - } - - /** - * Offset this BlockPos 1 block up - */ - public BlockPos up() - { - return this.up(1); - } - - /** - * Offset this BlockPos n blocks up - */ - public BlockPos up(int n) - { - return this.offset(Facing.UP, n); - } - - /** - * Offset this BlockPos 1 block down - */ - public BlockPos down() - { - return this.down(1); - } - - /** - * Offset this BlockPos n blocks down - */ - public BlockPos down(int n) - { - return this.offset(Facing.DOWN, n); - } - - /** - * Offset this BlockPos 1 block in northern direction - */ - public BlockPos north() - { - return this.north(1); - } - - /** - * Offset this BlockPos n blocks in northern direction - */ - public BlockPos north(int n) - { - return this.offset(Facing.NORTH, n); - } - - /** - * Offset this BlockPos 1 block in southern direction - */ - public BlockPos south() - { - return this.south(1); - } - - /** - * Offset this BlockPos n blocks in southern direction - */ - public BlockPos south(int n) - { - return this.offset(Facing.SOUTH, n); - } - - /** - * Offset this BlockPos 1 block in western direction - */ - public BlockPos west() - { - return this.west(1); - } - - /** - * Offset this BlockPos n blocks in western direction - */ - public BlockPos west(int n) - { - return this.offset(Facing.WEST, n); - } - - /** - * Offset this BlockPos 1 block in eastern direction - */ - public BlockPos east() - { - return this.east(1); - } - - /** - * Offset this BlockPos n blocks in eastern direction - */ - public BlockPos east(int n) - { - return this.offset(Facing.EAST, n); - } - - /** - * Offset this BlockPos 1 block in the given direction - */ - public BlockPos offset(Facing facing) - { - return this.offset(facing, 1); - } - - /** - * Offsets this BlockPos n blocks in the given direction - */ - public BlockPos offset(Facing facing, int n) - { - return n == 0 ? this : new BlockPos(this.getX() + facing.getFrontOffsetX() * n, this.getY() + facing.getFrontOffsetY() * n, this.getZ() + facing.getFrontOffsetZ() * n); - } - - /** - * Calculate the cross product of this and the given Vector - */ - public BlockPos crossProduct(Vec3i vec) - { - return new BlockPos(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX()); - } - - public static Iterable getAllInBox(BlockPos from, BlockPos to) - { - final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ())); - final BlockPos blockpos1 = new BlockPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ())); - return new Iterable() - { - public Iterator iterator() - { - return new AbstractIterator() - { - private BlockPos lastReturned = null; - protected BlockPos computeNext() - { - if (this.lastReturned == null) - { - this.lastReturned = blockpos; - return this.lastReturned; - } - else if (this.lastReturned.equals(blockpos1)) - { - return (BlockPos)this.endOfData(); - } - else - { - int i = this.lastReturned.getX(); - int j = this.lastReturned.getY(); - int k = this.lastReturned.getZ(); - - if (i < blockpos1.getX()) - { - ++i; - } - else if (j < blockpos1.getY()) - { - i = blockpos.getX(); - ++j; - } - else if (k < blockpos1.getZ()) - { - i = blockpos.getX(); - j = blockpos.getY(); - ++k; - } - - this.lastReturned = new BlockPos(i, j, k); - return this.lastReturned; - } - } - }; - } - }; - } - - public static Iterable getAllInBoxMutable(BlockPos from, BlockPos to) - { - final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ())); - final BlockPos blockpos1 = new BlockPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ())); - return new Iterable() - { - public Iterator iterator() - { - return new AbstractIterator() - { - private BlockPos.MutableBlockPos theBlockPos = null; - protected BlockPos.MutableBlockPos computeNext() - { - if (this.theBlockPos == null) - { - this.theBlockPos = new BlockPos.MutableBlockPos(blockpos.getX(), blockpos.getY(), blockpos.getZ()); - return this.theBlockPos; - } - else if (this.theBlockPos.equals(blockpos1)) - { - return (BlockPos.MutableBlockPos)this.endOfData(); - } - else - { - int i = this.theBlockPos.getX(); - int j = this.theBlockPos.getY(); - int k = this.theBlockPos.getZ(); - - if (i < blockpos1.getX()) - { - ++i; - } - else if (j < blockpos1.getY()) - { - i = blockpos.getX(); - ++j; - } - else if (k < blockpos1.getZ()) - { - i = blockpos.getX(); - j = blockpos.getY(); - ++k; - } - - this.theBlockPos.x = i; - this.theBlockPos.y = j; - this.theBlockPos.z = k; - return this.theBlockPos; - } - } - }; - } - }; - } - - public static final class MutableBlockPos extends BlockPos - { - private int x; - private int y; - private int z; - - public MutableBlockPos() - { - this(0, 0, 0); - } - - public MutableBlockPos(int x_, int y_, int z_) - { - super(0, 0, 0); - this.x = x_; - this.y = y_; - this.z = z_; - } - - public int getX() - { - return this.x; - } - - public int getY() - { - return this.y; - } - - public int getZ() - { - return this.z; - } - - public BlockPos.MutableBlockPos set(int xIn, int yIn, int zIn) - { - this.x = xIn; - this.y = yIn; - this.z = zIn; - return this; - } - } -} diff --git a/common/src/main/java/common/util/BoundingBox.java b/common/src/main/java/common/util/BoundingBox.java index 15206f54..41b2befa 100755 --- a/common/src/main/java/common/util/BoundingBox.java +++ b/common/src/main/java/common/util/BoundingBox.java @@ -21,7 +21,7 @@ public class BoundingBox this.maxZ = Math.max(z1, z2); } - public BoundingBox(BlockPos pos1, BlockPos pos2) + public BoundingBox(LocalPos pos1, LocalPos pos2) { this.minX = (double)pos1.getX(); this.minY = (double)pos1.getY(); @@ -242,7 +242,7 @@ public class BoundingBox */ public boolean isVecInside(Vec3 vec) { - return vec.xCoord > this.minX && vec.xCoord < this.maxX ? (vec.yCoord > this.minY && vec.yCoord < this.maxY ? vec.zCoord > this.minZ && vec.zCoord < this.maxZ : false) : false; + return vec.x > this.minX && vec.x < this.maxX ? (vec.y > this.minY && vec.y < this.maxY ? vec.z > this.minZ && vec.z < this.maxZ : false) : false; } /** @@ -272,12 +272,12 @@ public class BoundingBox public HitPosition calculateIntercept(Vec3 vecA, Vec3 vecB) { - Vec3 vec3 = vecA.getIntermediateWithXValue(vecB, this.minX); - Vec3 vec31 = vecA.getIntermediateWithXValue(vecB, this.maxX); - Vec3 vec32 = vecA.getIntermediateWithYValue(vecB, this.minY); - Vec3 vec33 = vecA.getIntermediateWithYValue(vecB, this.maxY); - Vec3 vec34 = vecA.getIntermediateWithZValue(vecB, this.minZ); - Vec3 vec35 = vecA.getIntermediateWithZValue(vecB, this.maxZ); + Vec3 vec3 = vecA.intermediateX(vecB, this.minX); + Vec3 vec31 = vecA.intermediateX(vecB, this.maxX); + Vec3 vec32 = vecA.intermediateY(vecB, this.minY); + Vec3 vec33 = vecA.intermediateY(vecB, this.maxY); + Vec3 vec34 = vecA.intermediateZ(vecB, this.minZ); + Vec3 vec35 = vecA.intermediateZ(vecB, this.maxZ); if (!this.isVecInYZ(vec3)) { @@ -316,27 +316,27 @@ public class BoundingBox vec36 = vec3; } - if (vec31 != null && (vec36 == null || vecA.squareDistanceTo(vec31) < vecA.squareDistanceTo(vec36))) + if (vec31 != null && (vec36 == null || vecA.distanceSq(vec31) < vecA.distanceSq(vec36))) { vec36 = vec31; } - if (vec32 != null && (vec36 == null || vecA.squareDistanceTo(vec32) < vecA.squareDistanceTo(vec36))) + if (vec32 != null && (vec36 == null || vecA.distanceSq(vec32) < vecA.distanceSq(vec36))) { vec36 = vec32; } - if (vec33 != null && (vec36 == null || vecA.squareDistanceTo(vec33) < vecA.squareDistanceTo(vec36))) + if (vec33 != null && (vec36 == null || vecA.distanceSq(vec33) < vecA.distanceSq(vec36))) { vec36 = vec33; } - if (vec34 != null && (vec36 == null || vecA.squareDistanceTo(vec34) < vecA.squareDistanceTo(vec36))) + if (vec34 != null && (vec36 == null || vecA.distanceSq(vec34) < vecA.distanceSq(vec36))) { vec36 = vec34; } - if (vec35 != null && (vec36 == null || vecA.squareDistanceTo(vec35) < vecA.squareDistanceTo(vec36))) + if (vec35 != null && (vec36 == null || vecA.distanceSq(vec35) < vecA.distanceSq(vec36))) { vec36 = vec35; } @@ -374,7 +374,7 @@ public class BoundingBox enumfacing = Facing.SOUTH; } - return new HitPosition(ObjectType.BLOCK, vec36, enumfacing, BlockPos.ORIGIN); + return new HitPosition(ObjectType.BLOCK, vec36, enumfacing, LocalPos.ORIGIN); } } @@ -383,7 +383,7 @@ public class BoundingBox */ private boolean isVecInYZ(Vec3 vec) { - return vec == null ? false : vec.yCoord >= this.minY && vec.yCoord <= this.maxY && vec.zCoord >= this.minZ && vec.zCoord <= this.maxZ; + return vec == null ? false : vec.y >= this.minY && vec.y <= this.maxY && vec.z >= this.minZ && vec.z <= this.maxZ; } /** @@ -391,7 +391,7 @@ public class BoundingBox */ private boolean isVecInXZ(Vec3 vec) { - return vec == null ? false : vec.xCoord >= this.minX && vec.xCoord <= this.maxX && vec.zCoord >= this.minZ && vec.zCoord <= this.maxZ; + return vec == null ? false : vec.x >= this.minX && vec.x <= this.maxX && vec.z >= this.minZ && vec.z <= this.maxZ; } /** @@ -399,7 +399,7 @@ public class BoundingBox */ private boolean isVecInXY(Vec3 vec) { - return vec == null ? false : vec.xCoord >= this.minX && vec.xCoord <= this.maxX && vec.yCoord >= this.minY && vec.yCoord <= this.maxY; + return vec == null ? false : vec.x >= this.minX && vec.x <= this.maxX && vec.y >= this.minY && vec.y <= this.maxY; } public String toString() diff --git a/common/src/main/java/common/util/WorldPos.java b/common/src/main/java/common/util/GlobalPos.java similarity index 59% rename from common/src/main/java/common/util/WorldPos.java rename to common/src/main/java/common/util/GlobalPos.java index 165251d3..8627bf62 100755 --- a/common/src/main/java/common/util/WorldPos.java +++ b/common/src/main/java/common/util/GlobalPos.java @@ -5,27 +5,27 @@ import common.init.DimensionRegistry; import common.world.World; @Serverside -public class WorldPos extends BlockPos { +public class GlobalPos extends LocalPos { private final int dim; - private WorldPos(int x, int y, int z, int dim) { + private GlobalPos(int x, int y, int z, int dim) { super(x, y, z); this.dim = dim; } - public WorldPos(int x, int y, int z, Dimension dim) { + public GlobalPos(int x, int y, int z, Dimension dim) { this(x, y, z, DimensionRegistry.getId(dim)); } - public WorldPos(int x, int y, int z, World world) { + public GlobalPos(int x, int y, int z, World world) { this(x, y, z, DimensionRegistry.getId(world.dimension)); } - public WorldPos(BlockPos pos, Dimension dim) { + public GlobalPos(LocalPos pos, Dimension dim) { this(pos.getX(), pos.getY(), pos.getZ(), DimensionRegistry.getId(dim)); } - public WorldPos(BlockPos pos, World world) { + public GlobalPos(LocalPos pos, World world) { this(pos.getX(), pos.getY(), pos.getZ(), DimensionRegistry.getId(world.dimension)); } @@ -34,16 +34,7 @@ public class WorldPos extends BlockPos { } public boolean equals(Object obj) { - if(this == obj) { - return true; - } - else if(!(obj instanceof WorldPos)) { - return false; - } - else { - WorldPos pos = (WorldPos)obj; - return this.getX() == pos.getX() && this.getY() == pos.getY() && this.getZ() == pos.getZ() && this.dim == pos.dim; - } + return this == obj || (obj instanceof GlobalPos other && this.getX() == other.getX() && this.getY() == other.getY() && this.getZ() == other.getZ() && this.dim == other.dim); } public int hashCode() { diff --git a/common/src/main/java/common/util/HitPosition.java b/common/src/main/java/common/util/HitPosition.java index 74e90e18..35cb1c5a 100755 --- a/common/src/main/java/common/util/HitPosition.java +++ b/common/src/main/java/common/util/HitPosition.java @@ -8,7 +8,7 @@ public class HitPosition { } public final ObjectType type; - public final BlockPos block; + public final LocalPos block; public final Facing side; public final Vec3 vec; public final Entity entity; @@ -17,12 +17,12 @@ public class HitPosition { this(entity, new Vec3(entity.posX, entity.posY, entity.posZ)); } - public HitPosition(ObjectType type, Vec3 vec, Facing side, BlockPos block) { + public HitPosition(ObjectType type, Vec3 vec, Facing side, LocalPos block) { this.type = type; this.block = block; this.side = side; this.entity = null; - this.vec = new Vec3(vec.xCoord, vec.yCoord, vec.zCoord); + this.vec = new Vec3(vec.x, vec.y, vec.z); } public HitPosition(Entity entity, Vec3 vec) { diff --git a/common/src/main/java/common/util/LocalPos.java b/common/src/main/java/common/util/LocalPos.java new file mode 100755 index 00000000..27c1871a --- /dev/null +++ b/common/src/main/java/common/util/LocalPos.java @@ -0,0 +1,147 @@ +package common.util; + +import java.util.Iterator; + +import common.collect.AbstractIterator; +import common.entity.Entity; + +public class LocalPos extends Vec3i { + public static final LocalPos ORIGIN = new LocalPos(0, 0, 0); + + public LocalPos(int x, int y, int z) { + super(x, y, z); + } + + public LocalPos(double x, double y, double z) { + super(x, y, z); + } + + public LocalPos(Entity entity) { + super(entity.posX, entity.posY, entity.posZ); + } + + public LocalPos(Vec3 vec) { + super(vec.x, vec.y, vec.z); + } + + public LocalPos(Vec3i vec) { + super(vec.getX(), vec.getY(), vec.getZ()); + } + + public LocalPos add(double x, double y, double z) { + return x == 0.0D && y == 0.0D && z == 0.0D ? this : new LocalPos((double)this.getX() + x, (double)this.getY() + y, (double)this.getZ() + z); + } + + public LocalPos add(int x, int y, int z) { + return x == 0 && y == 0 && z == 0 ? this : new LocalPos(this.getX() + x, this.getY() + y, this.getZ() + z); + } + + public LocalPos add(Vec3i vec) { + return vec.getX() == 0 && vec.getY() == 0 && vec.getZ() == 0 ? this : new LocalPos(this.getX() + vec.getX(), this.getY() + vec.getY(), this.getZ() + vec.getZ()); + } + + public LocalPos subtract(Vec3i vec) { + return vec.getX() == 0 && vec.getY() == 0 && vec.getZ() == 0 ? this : new LocalPos(this.getX() - vec.getX(), this.getY() - vec.getY(), this.getZ() - vec.getZ()); + } + + public LocalPos up() { + return this.offset(Facing.UP); + } + + public LocalPos up(int n) { + return this.offset(Facing.UP, n); + } + + public LocalPos down() { + return this.offset(Facing.DOWN); + } + + public LocalPos down(int n) { + return this.offset(Facing.DOWN, n); + } + + public LocalPos north() { + return this.offset(Facing.NORTH); + } + + public LocalPos north(int n) { + return this.offset(Facing.NORTH, n); + } + + public LocalPos south() { + return this.offset(Facing.SOUTH); + } + + public LocalPos south(int n) { + return this.offset(Facing.SOUTH, n); + } + + public LocalPos west() { + return this.offset(Facing.WEST); + } + + public LocalPos west(int n) { + return this.offset(Facing.WEST, n); + } + + public LocalPos east() { + return this.offset(Facing.EAST); + } + + public LocalPos east(int n) { + return this.offset(Facing.EAST, n); + } + + public LocalPos offset(Facing facing) { + return new LocalPos(this.getX() + facing.getFrontOffsetX(), this.getY() + facing.getFrontOffsetY(), this.getZ() + facing.getFrontOffsetZ()); + } + + public LocalPos offset(Facing facing, int n) { + return n == 0 ? this : new LocalPos(this.getX() + facing.getFrontOffsetX() * n, this.getY() + facing.getFrontOffsetY() * n, this.getZ() + facing.getFrontOffsetZ() * n); + } + + public LocalPos cross(Vec3i vec) { + return new LocalPos(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX()); + } + + public static Iterable area(LocalPos from, LocalPos to) { + final LocalPos pos1 = new LocalPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ())); + final LocalPos pos2 = new LocalPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ())); + return new Iterable() { + public Iterator iterator() { + return new AbstractIterator() { + private LocalPos last = null; + + protected LocalPos computeNext() { + if(this.last == null) { + this.last = pos1; + return this.last; + } + else if(this.last.equals(pos2)) { + return this.endOfData(); + } + else { + int x = this.last.getX(); + int y = this.last.getY(); + int z = this.last.getZ(); + if(x < pos2.getX()) { + ++x; + } + else if(y < pos2.getY()) { + x = pos1.getX(); + ++y; + } + else if(z < pos2.getZ()) { + x = pos1.getX(); + y = pos1.getY(); + ++z; + } + this.last = new LocalPos(x, y, z); + return this.last; + } + } + }; + } + }; + } +} diff --git a/common/src/main/java/common/util/MutablePos.java b/common/src/main/java/common/util/MutablePos.java new file mode 100644 index 00000000..c5cca7bd --- /dev/null +++ b/common/src/main/java/common/util/MutablePos.java @@ -0,0 +1,84 @@ +package common.util; + +import java.util.Iterator; + +import common.collect.AbstractIterator; + +public final class MutablePos extends LocalPos { + private int x; + private int y; + private int z; + + public MutablePos() { + this(0, 0, 0); + } + + public MutablePos(int x, int y, int z) { + super(0, 0, 0); + this.x = x; + this.y = y; + this.z = z; + } + + public int getX() { + return this.x; + } + + public int getY() { + return this.y; + } + + public int getZ() { + return this.z; + } + + public MutablePos set(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + return this; + } + + public static Iterable mutableArea(LocalPos from, LocalPos to) { + final LocalPos pos1 = new LocalPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ())); + final LocalPos pos2 = new LocalPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ())); + return new Iterable() { + public Iterator iterator() { + return new AbstractIterator() { + private MutablePos last = null; + + protected MutablePos computeNext() { + if(this.last == null) { + this.last = new MutablePos(pos1.getX(), pos1.getY(), pos1.getZ()); + return this.last; + } + else if(this.last.equals(pos2)) { + return this.endOfData(); + } + else { + int x = this.last.getX(); + int y = this.last.getY(); + int z = this.last.getZ(); + if(x < pos2.getX()) { + ++x; + } + else if(y < pos2.getY()) { + x = pos1.getX(); + ++y; + } + else if(z < pos2.getZ()) { + x = pos1.getX(); + y = pos1.getY(); + ++z; + } + this.last.x = x; + this.last.y = y; + this.last.z = z; + return this.last; + } + } + }; + } + }; + } +} \ No newline at end of file diff --git a/common/src/main/java/common/util/NibbleArray.java b/common/src/main/java/common/util/NibbleArray.java deleted file mode 100755 index 629be8d3..00000000 --- a/common/src/main/java/common/util/NibbleArray.java +++ /dev/null @@ -1,31 +0,0 @@ -package common.util; - -public class NibbleArray { - private final byte[] data; - - public NibbleArray() { - this.data = new byte[2048]; - } - - public NibbleArray(byte[] data) { - if(data.length != 2048) - throw new IllegalArgumentException("NibbleArray sollte 2048 Bytes groß sein, nicht " + data.length); - this.data = data; - } - - public int get(int x, int y, int z) { - int idx = y << 8 | z << 4 | x; - int off = idx >> 1; - return (idx & 1) == 0 ? this.data[off] & 15 : this.data[off] >> 4 & 15; - } - - public void set(int x, int y, int z, int value) { - int idx = y << 8 | z << 4 | x; - int off = idx >> 1; - this.data[off] = (idx & 1) == 0 ? (byte)(this.data[off] & 240 | value & 15) : (byte)(this.data[off] & 15 | (value & 15) << 4); - } - - public byte[] getData() { - return this.data; - } -} diff --git a/common/src/main/java/common/util/Position.java b/common/src/main/java/common/util/Position.java index 4659b92a..d54df4f1 100755 --- a/common/src/main/java/common/util/Position.java +++ b/common/src/main/java/common/util/Position.java @@ -26,15 +26,15 @@ public class Position extends Vec3 { } public double x() { - return this.xCoord; + return this.x; } public double y() { - return this.yCoord; + return this.y; } public double z() { - return this.zCoord; + return this.z; } public float yaw() { @@ -62,11 +62,11 @@ public class Position extends Vec3 { } else { Position pos = (Position)obj; - return this.xCoord == pos.xCoord && this.yCoord == pos.yCoord && this.zCoord == pos.zCoord && this.yaw == pos.yaw && this.pitch == pos.pitch && this.dim == pos.dim; + return this.x == pos.x && this.y == pos.y && this.z == pos.z && this.yaw == pos.yaw && this.pitch == pos.pitch && this.dim == pos.dim; } } public String toString() { - return "(" + this.getDimension() + ", " + this.xCoord + ", " + this.yCoord + ", " + this.zCoord + ", " + this.yaw + ", " + this.pitch + ")"; + return "(" + this.getDimension() + ", " + this.x + ", " + this.y + ", " + this.z + ", " + this.yaw + ", " + this.pitch + ")"; } } diff --git a/common/src/main/java/common/util/Vec3.java b/common/src/main/java/common/util/Vec3.java index e183bf14..9159bce5 100755 --- a/common/src/main/java/common/util/Vec3.java +++ b/common/src/main/java/common/util/Vec3.java @@ -1,211 +1,122 @@ package common.util; -public class Vec3 -{ - public final double xCoord; - public final double yCoord; - public final double zCoord; +public class Vec3 { + public final double x; + public final double y; + public final double z; - public Vec3(double x, double y, double z) - { - if (x == -0.0D) - { - x = 0.0D; - } + public Vec3(double x, double y, double z) { + if(x == -0.0D) + x = 0.0D; + if(y == -0.0D) + y = 0.0D; + if(z == -0.0D) + z = 0.0D; + this.x = x; + this.y = y; + this.z = z; + } - if (y == -0.0D) - { - y = 0.0D; - } - - if (z == -0.0D) - { - z = 0.0D; - } - - this.xCoord = x; - this.yCoord = y; - this.zCoord = z; - } - - public Vec3(Vec3i p_i46377_1_) - { - this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); - } - public Vec3(int color) { this((float)(color >> 16 & 255) / 255.0F, (float)(color >> 8 & 255) / 255.0F, (float)(color & 255) / 255.0F); } - /** - * Returns a new vector with the result of the specified vector minus this. - */ - public Vec3 subtractReverse(Vec3 vec) - { - return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); - } + public Vec3 subtractRev(Vec3 vec) { + return new Vec3(vec.x - this.x, vec.y - this.y, vec.z - this.z); + } - /** - * Normalizes the vector to a length of 1 (except if it is the zero vector) - */ - public Vec3 normalize() - { - double d0 = (double)ExtMath.sqrtd(this.xCoord * this.xCoord + this.yCoord * this.yCoord + this.zCoord * this.zCoord); - return d0 < 1.0E-4D ? new Vec3(0.0D, 0.0D, 0.0D) : new Vec3(this.xCoord / d0, this.yCoord / d0, this.zCoord / d0); - } + public Vec3 normalize() { + double len = (double)ExtMath.sqrtd(this.x * this.x + this.y * this.y + this.z * this.z); + return len < 1.0E-4D ? new Vec3(0.0D, 0.0D, 0.0D) : new Vec3(this.x / len, this.y / len, this.z / len); + } - public double dotProduct(Vec3 vec) - { - return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; - } + public double dot(Vec3 vec) { + return this.x * vec.x + this.y * vec.y + this.z * vec.z; + } - /** - * Returns a new vector with the result of this vector x the specified vector. - */ - public Vec3 crossProduct(Vec3 vec) - { - return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); - } + public Vec3 cross(Vec3 vec) { + return new Vec3(this.y * vec.z - this.z * vec.y, this.z * vec.x - this.x * vec.z, this.x * vec.y - this.y * vec.x); + } - public Vec3 subtract(Vec3 vec) - { - return this.subtract(vec.xCoord, vec.yCoord, vec.zCoord); - } + public Vec3 subtract(Vec3 vec) { + return this.subtract(vec.x, vec.y, vec.z); + } - public Vec3 subtract(double x, double y, double z) - { - return this.addVector(-x, -y, -z); - } + public Vec3 subtract(double x, double y, double z) { + return this.add(-x, -y, -z); + } - public Vec3 add(Vec3 vec) - { - return this.addVector(vec.xCoord, vec.yCoord, vec.zCoord); - } + public Vec3 add(Vec3 vec) { + return this.add(vec.x, vec.y, vec.z); + } - /** - * Adds the specified x,y,z vector components to this vector and returns the resulting vector. Does not change this - * vector. - */ - public Vec3 addVector(double x, double y, double z) - { - return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); - } + public Vec3 add(double x, double y, double z) { + return new Vec3(this.x + x, this.y + y, this.z + z); + } - /** - * Euclidean distance between this and the specified vector, returned as double. - */ - public double distanceTo(Vec3 vec) - { - double d0 = vec.xCoord - this.xCoord; - double d1 = vec.yCoord - this.yCoord; - double d2 = vec.zCoord - this.zCoord; - return (double)ExtMath.sqrtd(d0 * d0 + d1 * d1 + d2 * d2); - } + public double distance(Vec3 vec) { + double x = vec.x - this.x; + double y = vec.y - this.y; + double z = vec.z - this.z; + return (double)ExtMath.sqrtd(x * x + y * y + z * z); + } - /** - * The square of the Euclidean distance between this and the specified vector. - */ - public double squareDistanceTo(Vec3 vec) - { - double d0 = vec.xCoord - this.xCoord; - double d1 = vec.yCoord - this.yCoord; - double d2 = vec.zCoord - this.zCoord; - return d0 * d0 + d1 * d1 + d2 * d2; - } + public double distanceSq(Vec3 vec) { + double x = vec.x - this.x; + double y = vec.y - this.y; + double z = vec.z - this.z; + return x * x + y * y + z * z; + } - /** - * Returns the length of the vector. - */ - public double lengthVector() - { - return (double)ExtMath.sqrtd(this.xCoord * this.xCoord + this.yCoord * this.yCoord + this.zCoord * this.zCoord); - } + public double length() { + return (double)ExtMath.sqrtd(this.x * this.x + this.y * this.y + this.z * this.z); + } - /** - * Returns a new vector with x value equal to the second parameter, along the line between this vector and the - * passed in vector, or null if not possible. - */ - public Vec3 getIntermediateWithXValue(Vec3 vec, double x) - { - double d0 = vec.xCoord - this.xCoord; - double d1 = vec.yCoord - this.yCoord; - double d2 = vec.zCoord - this.zCoord; + public Vec3 intermediateX(Vec3 vec, double v) { + double x = vec.x - this.x; + if(x * x < 1.0000000116860974E-7D) + return null; + double y = vec.y - this.y; + double z = vec.z - this.z; + double n = (v - this.x) / x; + return n >= 0.0D && n <= 1.0D ? new Vec3(this.x + x * n, this.y + y * n, this.z + z * n) : null; + } - if (d0 * d0 < 1.0000000116860974E-7D) - { - return null; - } - else - { - double d3 = (x - this.xCoord) / d0; - return d3 >= 0.0D && d3 <= 1.0D ? new Vec3(this.xCoord + d0 * d3, this.yCoord + d1 * d3, this.zCoord + d2 * d3) : null; - } - } + public Vec3 intermediateY(Vec3 vec, double v) { + double y = vec.y - this.y; + if(y * y < 1.0000000116860974E-7D) + return null; + double x = vec.x - this.x; + double z = vec.z - this.z; + double n = (v - this.y) / y; + return n >= 0.0D && n <= 1.0D ? new Vec3(this.x + x * n, this.y + y * n, this.z + z * n) : null; + } - /** - * Returns a new vector with y value equal to the second parameter, along the line between this vector and the - * passed in vector, or null if not possible. - */ - public Vec3 getIntermediateWithYValue(Vec3 vec, double y) - { - double d0 = vec.xCoord - this.xCoord; - double d1 = vec.yCoord - this.yCoord; - double d2 = vec.zCoord - this.zCoord; + public Vec3 intermediateZ(Vec3 vec, double v) { + double z = vec.z - this.z; + if(z * z < 1.0000000116860974E-7D) + return null; + double x = vec.x - this.x; + double y = vec.y - this.y; + double n = (v - this.z) / z; + return n >= 0.0D && n <= 1.0D ? new Vec3(this.x + x * n, this.y + y * n, this.z + z * n) : null; + } - if (d1 * d1 < 1.0000000116860974E-7D) - { - return null; - } - else - { - double d3 = (y - this.yCoord) / d1; - return d3 >= 0.0D && d3 <= 1.0D ? new Vec3(this.xCoord + d0 * d3, this.yCoord + d1 * d3, this.zCoord + d2 * d3) : null; - } - } + public Vec3 pitch(float pitch) { + double cos = (double)ExtMath.cos(pitch); + double sin = (double)ExtMath.sin(pitch); + double x = this.x; + double y = this.y * cos + this.z * sin; + double z = this.z * cos - this.y * sin; + return new Vec3(x, y, z); + } - /** - * Returns a new vector with z value equal to the second parameter, along the line between this vector and the - * passed in vector, or null if not possible. - */ - public Vec3 getIntermediateWithZValue(Vec3 vec, double z) - { - double d0 = vec.xCoord - this.xCoord; - double d1 = vec.yCoord - this.yCoord; - double d2 = vec.zCoord - this.zCoord; - - if (d2 * d2 < 1.0000000116860974E-7D) - { - return null; - } - else - { - double d3 = (z - this.zCoord) / d2; - return d3 >= 0.0D && d3 <= 1.0D ? new Vec3(this.xCoord + d0 * d3, this.yCoord + d1 * d3, this.zCoord + d2 * d3) : null; - } - } - - public String toString() - { - return "(" + this.xCoord + ", " + this.yCoord + ", " + this.zCoord + ")"; - } - - public Vec3 rotatePitch(float pitch) - { - float f = ExtMath.cos(pitch); - float f1 = ExtMath.sin(pitch); - double d0 = this.xCoord; - double d1 = this.yCoord * (double)f + this.zCoord * (double)f1; - double d2 = this.zCoord * (double)f - this.yCoord * (double)f1; - return new Vec3(d0, d1, d2); - } - - public Vec3 rotateYaw(float yaw) - { - float f = ExtMath.cos(yaw); - float f1 = ExtMath.sin(yaw); - double d0 = this.xCoord * (double)f + this.zCoord * (double)f1; - double d1 = this.yCoord; - double d2 = this.zCoord * (double)f - this.xCoord * (double)f1; - return new Vec3(d0, d1, d2); - } + public Vec3 yaw(float yaw) { + double cos = (double)ExtMath.cos(yaw); + double sin = (double)ExtMath.sin(yaw); + double x = this.x * cos + this.z * sin; + double y = this.y; + double z = this.z * cos - this.x * sin; + return new Vec3(x, y, z); + } } diff --git a/common/src/main/java/common/util/Vec3i.java b/common/src/main/java/common/util/Vec3i.java index 87ad35e4..ffdad4bc 100755 --- a/common/src/main/java/common/util/Vec3i.java +++ b/common/src/main/java/common/util/Vec3i.java @@ -1,122 +1,67 @@ package common.util; -public class Vec3i implements Comparable -{ -// /** The Null vector constant (0, 0, 0) */ -// public static final Vec3i NULL_VECTOR = new Vec3i(0, 0, 0); +public class Vec3i implements Comparable { + private final int x; + private final int y; + private final int z; - /** X coordinate */ - private final int x; + public Vec3i(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } - /** Y coordinate */ - private final int y; + public Vec3i(double x, double y, double z) { + this(ExtMath.floord(x), ExtMath.floord(y), ExtMath.floord(z)); + } - /** Z coordinate */ - private final int z; + public boolean equals(Object obj) { + return this == obj || (obj instanceof Vec3i other && this.getX() == other.getX() && this.getY() == other.getY() && this.getZ() == other.getZ()); + } - public Vec3i(int xIn, int yIn, int zIn) - { - this.x = xIn; - this.y = yIn; - this.z = zIn; - } + public int hashCode() { + return (this.getY() + this.getZ() * 31) * 31 + this.getX(); + } - public Vec3i(double xIn, double yIn, double zIn) - { - this(ExtMath.floord(xIn), ExtMath.floord(yIn), ExtMath.floord(zIn)); - } + public int compareTo(Vec3i other) { + return this.getY() == other.getY() ? (this.getZ() == other.getZ() ? this.getX() - other.getX() : this.getZ() - other.getZ()) : this.getY() - other.getY(); + } - public boolean equals(Object p_equals_1_) - { - if (this == p_equals_1_) - { - return true; - } - else if (!(p_equals_1_ instanceof Vec3i)) - { - return false; - } - else - { - Vec3i vec3i = (Vec3i)p_equals_1_; - return this.getX() != vec3i.getX() ? false : (this.getY() != vec3i.getY() ? false : this.getZ() == vec3i.getZ()); - } - } + public int getX() { + return this.x; + } - public int hashCode() - { - return (this.getY() + this.getZ() * 31) * 31 + this.getX(); - } + public int getY() { + return this.y; + } - public int compareTo(Vec3i p_compareTo_1_) - { - return this.getY() == p_compareTo_1_.getY() ? (this.getZ() == p_compareTo_1_.getZ() ? this.getX() - p_compareTo_1_.getX() : this.getZ() - p_compareTo_1_.getZ()) : this.getY() - p_compareTo_1_.getY(); - } + public int getZ() { + return this.z; + } - /** - * Get the X coordinate - */ - public int getX() - { - return this.x; - } + public Vec3i cross(Vec3i vec) { + return new Vec3i(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX()); + } - /** - * Get the Y coordinate - */ - public int getY() - { - return this.y; - } + public double distanceSq(double x, double y, double z) { + double dx = (double)this.getX() - x; + double dy = (double)this.getY() - y; + double dz = (double)this.getZ() - z; + return dx * dx + dy * dy + dz * dz; + } - /** - * Get the Z coordinate - */ - public int getZ() - { - return this.z; - } + public double distanceSqCenter(double x, double y, double z) { + double dx = (double)this.getX() + 0.5D - x; + double dy = (double)this.getY() + 0.5D - y; + double dz = (double)this.getZ() + 0.5D - z; + return dx * dx + dy * dy + dz * dz; + } - /** - * Calculate the cross product of this and the given Vector - */ - public Vec3i crossProduct(Vec3i vec) - { - return new Vec3i(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX()); - } + public double distanceSq(Vec3i vec) { + return this.distanceSq((double)vec.getX(), (double)vec.getY(), (double)vec.getZ()); + } - /** - * Calculate squared distance to the given coordinates - */ - public double distanceSq(double toX, double toY, double toZ) - { - double d0 = (double)this.getX() - toX; - double d1 = (double)this.getY() - toY; - double d2 = (double)this.getZ() - toZ; - return d0 * d0 + d1 * d1 + d2 * d2; - } - - /** - * Compute square of distance from point x, y, z to center of this Block - */ - public double distanceSqToCenter(double xIn, double yIn, double zIn) - { - double d0 = (double)this.getX() + 0.5D - xIn; - double d1 = (double)this.getY() + 0.5D - yIn; - double d2 = (double)this.getZ() + 0.5D - zIn; - return d0 * d0 + d1 * d1 + d2 * d2; - } - - /** - * Calculate squared distance to the given Vector - */ - public double distanceSq(Vec3i to) - { - return this.distanceSq((double)to.getX(), (double)to.getY(), (double)to.getZ()); - } - - public String toString() - { - return this.getX() + ", " + this.getY() + ", " + this.getZ(); - } + public String toString() { + return this.getX() + ", " + this.getY() + ", " + this.getZ(); + } } diff --git a/common/src/main/java/common/village/Village.java b/common/src/main/java/common/village/Village.java index 0e6f6930..312455f7 100755 --- a/common/src/main/java/common/village/Village.java +++ b/common/src/main/java/common/village/Village.java @@ -8,15 +8,15 @@ import common.block.Material; import common.block.artificial.BlockDoor; import common.collect.Lists; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.AWorldServer; public class Village { private final List doors = Lists.newArrayList(); - private BlockPos doorRange = BlockPos.ORIGIN; - private BlockPos center = BlockPos.ORIGIN; + private LocalPos doorRange = LocalPos.ORIGIN; + private LocalPos center = LocalPos.ORIGIN; private int radius; // public Village() @@ -64,7 +64,7 @@ public class Village } } - public BlockPos getCenter() + public LocalPos getCenter() { return this.center; } @@ -99,7 +99,7 @@ public class Village return this.doors; } - public VillageDoorInfo getNearestDoor(BlockPos pos) + public VillageDoorInfo getNearestDoor(LocalPos pos) { VillageDoorInfo villagedoorinfo = null; int i = Integer.MAX_VALUE; @@ -118,7 +118,7 @@ public class Village return villagedoorinfo; } - public VillageDoorInfo getDoorInfo(BlockPos pos) + public VillageDoorInfo getDoorInfo(LocalPos pos) { VillageDoorInfo villagedoorinfo = null; int i = Integer.MAX_VALUE; @@ -146,7 +146,7 @@ public class Village return villagedoorinfo; } - public VillageDoorInfo getExistedDoor(BlockPos doorBlock) + public VillageDoorInfo getExistedDoor(LocalPos doorBlock) { if (this.center.distanceSq(doorBlock) > (double)(this.radius * this.radius)) { @@ -179,7 +179,7 @@ public class Village return this.doors.isEmpty(); } - private boolean isWoodDoor(AWorldServer world, BlockPos pos) + private boolean isWoodDoor(AWorldServer world, LocalPos pos) { Block block = world.getState(pos).getBlock(); return block instanceof BlockDoor ? block.getMaterial() == Material.WOOD : false; @@ -191,12 +191,12 @@ public class Village if (i == 0) { - this.center = new BlockPos(0, 0, 0); + this.center = new LocalPos(0, 0, 0); this.radius = 0; } else { - this.center = new BlockPos(this.doorRange.getX() / i, this.doorRange.getY() / i, this.doorRange.getZ() / i); + this.center = new LocalPos(this.doorRange.getX() / i, this.doorRange.getY() / i, this.doorRange.getZ() / i); int j = 0; for (VillageDoorInfo villagedoorinfo : this.doors) @@ -211,14 +211,14 @@ public class Village public void readTags(TagObject tag) { this.radius = tag.getInt("Radius"); - this.center = new BlockPos(tag.getInt("CX"), tag.getInt("CY"), tag.getInt("CZ")); - this.doorRange = new BlockPos(tag.getInt("ACX"), tag.getInt("ACY"), tag.getInt("ACZ")); + this.center = new LocalPos(tag.getInt("CX"), tag.getInt("CY"), tag.getInt("CZ")); + this.doorRange = new LocalPos(tag.getInt("ACX"), tag.getInt("ACY"), tag.getInt("ACZ")); List doors = tag.getList("Doors"); for (int i = 0; i < doors.size(); ++i) { TagObject door = doors.get(i); - VillageDoorInfo info = new VillageDoorInfo(new BlockPos(door.getInt("X"), door.getInt("Y"), door.getInt("Z")), door.getInt("IDX"), door.getInt("IDZ"), door.getInt("TS")); + VillageDoorInfo info = new VillageDoorInfo(new LocalPos(door.getInt("X"), door.getInt("Y"), door.getInt("Z")), door.getInt("IDX"), door.getInt("IDZ"), door.getInt("TS")); this.doors.add(info); } } diff --git a/common/src/main/java/common/village/VillageDoorInfo.java b/common/src/main/java/common/village/VillageDoorInfo.java index 530d3097..2333a168 100755 --- a/common/src/main/java/common/village/VillageDoorInfo.java +++ b/common/src/main/java/common/village/VillageDoorInfo.java @@ -1,13 +1,13 @@ package common.village; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; public class VillageDoorInfo { /** a block representing the door. Could be either upper or lower part */ - private final BlockPos doorBlockPos; - private final BlockPos insideBlock; + private final LocalPos doorBlockPos; + private final LocalPos insideBlock; /** the inside direction is where can see less sky */ private final Facing insideDirection; @@ -15,7 +15,7 @@ public class VillageDoorInfo private boolean isDetachedFromVillageFlag; private int doorOpeningRestrictionCounter; - public VillageDoorInfo(BlockPos pos, int p_i45871_2_, int p_i45871_3_, int p_i45871_4_) + public VillageDoorInfo(LocalPos pos, int p_i45871_2_, int p_i45871_3_, int p_i45871_4_) { this(pos, getFaceDirection(p_i45871_2_, p_i45871_3_), p_i45871_4_); } @@ -25,7 +25,7 @@ public class VillageDoorInfo return deltaX < 0 ? Facing.WEST : (deltaX > 0 ? Facing.EAST : (deltaZ < 0 ? Facing.NORTH : Facing.SOUTH)); } - public VillageDoorInfo(BlockPos pos, Facing facing, int timestamp) + public VillageDoorInfo(LocalPos pos, Facing facing, int timestamp) { this.doorBlockPos = pos; this.insideDirection = facing; @@ -41,17 +41,17 @@ public class VillageDoorInfo return (int)this.doorBlockPos.distanceSq((double)x, (double)y, (double)z); } - public int getDistanceToDoorBlockSq(BlockPos pos) + public int getDistanceToDoorBlockSq(LocalPos pos) { return (int)pos.distanceSq(this.getDoorBlockPos()); } - public int getDistanceToInsideBlockSq(BlockPos pos) + public int getDistanceToInsideBlockSq(LocalPos pos) { return (int)this.insideBlock.distanceSq(pos); } - public boolean isIndoorSide(BlockPos pos) + public boolean isIndoorSide(LocalPos pos) { int i = pos.getX() - this.doorBlockPos.getX(); int j = pos.getZ() - this.doorBlockPos.getY(); @@ -73,12 +73,12 @@ public class VillageDoorInfo return this.doorOpeningRestrictionCounter; } - public BlockPos getDoorBlockPos() + public LocalPos getDoorBlockPos() { return this.doorBlockPos; } - public BlockPos getInsideBlockPos() + public LocalPos getInsideBlockPos() { return this.insideBlock; } diff --git a/common/src/main/java/common/world/AWorldServer.java b/common/src/main/java/common/world/AWorldServer.java index c145c3ff..3a775b58 100644 --- a/common/src/main/java/common/world/AWorldServer.java +++ b/common/src/main/java/common/world/AWorldServer.java @@ -11,7 +11,7 @@ import common.entity.types.EntityLiving; import common.network.IPlayer; import common.network.Packet; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ParticleType; import common.util.PortalType; @@ -25,11 +25,11 @@ public abstract class AWorldServer extends World { public abstract List getAllPlayers(); public abstract AWorldServer getOtherWorld(Dimension dimension); public abstract Dimension getPortalDest(PortalType portal); - public abstract void placeInDimension(Entity entity, AWorldServer oldWorld, AWorldServer world, BlockPos pos, PortalType portal); - public abstract boolean addLoader(BlockPos pos); - public abstract boolean removeLoader(BlockPos pos); - public abstract boolean isBlockTickPending(BlockPos pos, Block blockType); - public abstract void updateBlockTick(BlockPos pos, Block blockIn, int delay, int priority); + public abstract void placeInDimension(Entity entity, AWorldServer oldWorld, AWorldServer world, LocalPos pos, PortalType portal); + public abstract boolean addLoader(LocalPos pos); + public abstract boolean removeLoader(LocalPos pos); + public abstract boolean isBlockTickPending(LocalPos pos, Block blockType); + public abstract void updateBlockTick(LocalPos pos, Block blockIn, int delay, int priority); public abstract void resetUpdateEntityTick(); public abstract void strikeLightning(double x, double y, double z, int color, int damage, boolean fire, EntityLiving summoner); public abstract void resetWeather(); @@ -40,19 +40,19 @@ public abstract class AWorldServer extends World { public abstract long getSeed(); public abstract boolean isExterminated(); public abstract boolean exterminate(); - public abstract Village getNearestVillage(BlockPos doorBlock, int radius); - public abstract void addToVillagerPositionList(BlockPos blockpos); + public abstract Village getNearestVillage(LocalPos doorBlock, int radius); + public abstract void addToVillagerPositionList(LocalPos blockpos); public abstract boolean isPlayerWatchingChunk(EntityNPC player, int chunkX, int chunkZ); public abstract void sendToAllTrackingEntity(Entity entityIn, Packet packet); public abstract T findNearestEntityWithinAABB(Class entityType, BoundingBox aabb, T closestTo); - public abstract void markChunkDirty(BlockPos pos); - public abstract void growGrass(BlockPos pos, State state, Random rand); - public abstract boolean generateBigMushroom(BlockPos pos, State state, Random rand); - public abstract void generateTree(BlockPos pos, State state, Random rand); + public abstract void markChunkDirty(LocalPos pos); + public abstract void growGrass(LocalPos pos, State state, Random rand); + public abstract boolean generateBigMushroom(LocalPos pos, State state, Random rand); + public abstract void generateTree(LocalPos pos, State state, Random rand); public abstract float getGenTemperature(int x, int z); public abstract float getGenHumidity(int x, int z); - public abstract LeavesType getLeavesGen(BlockPos pos); - public abstract void scheduleUpdate(BlockPos pos, Block blockIn, int delay); - public abstract void notifyNeighborsOfStateChange(BlockPos pos, Block blockType); - public abstract boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj); + public abstract LeavesType getLeavesGen(LocalPos pos); + public abstract void scheduleUpdate(LocalPos pos, Block blockIn, int delay); + public abstract void notifyNeighborsOfStateChange(LocalPos pos, Block blockType); + public abstract boolean canBlockFreeze(LocalPos pos, boolean noWaterAdj); } diff --git a/common/src/main/java/common/world/BlockArray.java b/common/src/main/java/common/world/BlockArray.java index ef6abdf2..516869ce 100755 --- a/common/src/main/java/common/world/BlockArray.java +++ b/common/src/main/java/common/world/BlockArray.java @@ -5,7 +5,6 @@ import java.util.Arrays; import common.block.Block; import common.init.BlockRegistry; import common.init.Blocks; -import common.util.NibbleArray; public class BlockArray { private final int yBase; diff --git a/common/src/main/java/common/world/Chunk.java b/common/src/main/java/common/world/Chunk.java index a32fd0cc..fdc96d48 100755 --- a/common/src/main/java/common/world/Chunk.java +++ b/common/src/main/java/common/world/Chunk.java @@ -15,7 +15,7 @@ import common.entity.Entity; import common.init.Blocks; import common.log.Log; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.InheritanceMultiMap; import common.util.ExtMath; @@ -31,7 +31,7 @@ public abstract class Chunk { protected final Set blockList = Sets.newHashSet(); protected final int[] precHeight = new int[256]; protected final int[] height = new int[256]; - protected final Map tiles = Maps.newHashMap(); + protected final Map tiles = Maps.newHashMap(); protected final InheritanceMultiMap[] entities = new InheritanceMultiMap[32]; protected boolean loaded; @@ -133,7 +133,7 @@ public abstract class Chunk { } } - private int getOpacity(BlockPos pos) { + private int getOpacity(LocalPos pos) { return this.getBlock(pos).getLightOpacity(); } @@ -146,16 +146,16 @@ public abstract class Chunk { return stor != null ? stor.getBlock(x, y & 15, z) : (y < 0 ? this.fillerBlock : Blocks.air); } - public State getState(BlockPos pos) { + public State getState(LocalPos pos) { BlockArray stor = this.getArray(pos.getY() >> 4); return stor != null ? stor.get(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15) : (pos.getY() < 0 ? this.filler : Blocks.air.getState()); } - public Block getBlock(BlockPos pos) { + public Block getBlock(LocalPos pos) { return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15); } - public State setState(BlockPos pos, State state, boolean updateHeight) { + public State setState(LocalPos pos, State state, boolean updateHeight) { int x = pos.getX() & 15; int y = pos.getY(); int z = pos.getZ() & 15; @@ -294,12 +294,12 @@ public abstract class Chunk { this.entities[y].remove(entity); } - protected TileEntity createNewTileEntity(BlockPos pos) { + protected TileEntity createNewTileEntity(LocalPos pos) { Block block = this.getBlock(pos); return !(block instanceof ITileEntityProvider provider) ? null : provider.createNewTileEntity(); } - public TileEntity getTileEntity(BlockPos pos, TileEntity.CreateMode type) { + public TileEntity getTileEntity(LocalPos pos, TileEntity.CreateMode type) { TileEntity tile = this.tiles.get(pos); if(tile == null) { @@ -316,7 +316,7 @@ public abstract class Chunk { return tile; } - public void addTileEntity(BlockPos pos, TileEntity tile) { + public void addTileEntity(LocalPos pos, TileEntity tile) { tile.setWorld(this.world); tile.setPos(pos); @@ -332,7 +332,7 @@ public abstract class Chunk { } } - public void removeTileEntity(BlockPos pos) { + public void removeTileEntity(LocalPos pos) { if(this.loaded) { TileEntity tile = this.tiles.remove(pos); @@ -387,16 +387,16 @@ public abstract class Chunk { } } - public BlockPos getPrecipitation(BlockPos pos) { + public LocalPos getPrecipitation(LocalPos pos) { int x = pos.getX() & 15; int z = pos.getZ() & 15; int o = x | z << 4; - BlockPos loc = new BlockPos(pos.getX(), this.precHeight[o], pos.getZ()); + LocalPos loc = new LocalPos(pos.getX(), this.precHeight[o], pos.getZ()); if(loc.getY() == Integer.MIN_VALUE) { int y = this.top + 15; int min = this.bottom < -64 ? -64 : this.bottom; - loc = new BlockPos(pos.getX(), y, pos.getZ()); + loc = new LocalPos(pos.getX(), y, pos.getZ()); while(loc.getY() > min) { Block block = this.getBlock(loc); @@ -408,14 +408,14 @@ public abstract class Chunk { loc = loc.down(); } else { - return new BlockPos(pos.getX(), this.precHeight[o] = loc.getY() + 1, pos.getZ()); + return new LocalPos(pos.getX(), this.precHeight[o] = loc.getY() + 1, pos.getZ()); } } - return new BlockPos(pos.getX(), this.precHeight[o] = -64, pos.getZ()); + return new LocalPos(pos.getX(), this.precHeight[o] = -64, pos.getZ()); } - return new BlockPos(pos.getX(), this.precHeight[o], pos.getZ()); + return new LocalPos(pos.getX(), this.precHeight[o], pos.getZ()); } public boolean isLoaded() { diff --git a/common/src/main/java/common/world/IBlockAccess.java b/common/src/main/java/common/world/IBlockAccess.java index 11fa2ab4..6f4d7fd6 100755 --- a/common/src/main/java/common/world/IBlockAccess.java +++ b/common/src/main/java/common/world/IBlockAccess.java @@ -1,8 +1,8 @@ package common.world; -import common.util.BlockPos; +import common.util.LocalPos; public interface IBlockAccess { - State getState(BlockPos pos); + State getState(LocalPos pos); } diff --git a/common/src/main/java/common/world/IWorldAccess.java b/common/src/main/java/common/world/IWorldAccess.java index d2d9e945..c6afe85b 100755 --- a/common/src/main/java/common/world/IWorldAccess.java +++ b/common/src/main/java/common/world/IWorldAccess.java @@ -1,12 +1,12 @@ package common.world; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Clientside; public interface IWorldAccess extends IBlockAccess { - TileEntity getTileEntity(BlockPos pos); + TileEntity getTileEntity(LocalPos pos); @Clientside - int getCombinedLight(BlockPos pos); + int getCombinedLight(LocalPos pos); } diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index efff0476..66324931 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -29,13 +29,14 @@ import common.item.ItemStack; import common.rng.Random; import common.tileentity.ITickable; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ChunkPos; import common.util.ExtMath; import common.util.Facing; import common.util.HitPosition; import common.util.IntHashMap; +import common.util.MutablePos; import common.util.ParticleType; import common.util.Vec3; import common.vars.Vars; @@ -70,7 +71,7 @@ public abstract class World implements IWorldAccess { protected long orbit; protected long rotation; - public boolean isBlockSolid(BlockPos pos) { + public boolean isBlockSolid(LocalPos pos) { return isSolidSurface(this.getState(pos)); } @@ -84,12 +85,12 @@ public abstract class World implements IWorldAccess { : false)))); } - public static boolean isValid(BlockPos pos) { + public static boolean isValid(LocalPos pos) { return pos.getX() >= -MAX_SIZE && pos.getZ() >= -MAX_SIZE && pos.getX() < MAX_SIZE && pos.getZ() < MAX_SIZE && pos.getY() >= -MAX_SIZE_Y && pos.getY() < MAX_SIZE_Y; } - public static boolean isValidXZ(BlockPos pos) { + public static boolean isValidXZ(LocalPos pos) { return pos.getX() >= -MAX_SIZE && pos.getZ() >= -MAX_SIZE && pos.getX() < MAX_SIZE && pos.getZ() < MAX_SIZE; } @@ -109,32 +110,32 @@ public abstract class World implements IWorldAccess { this.gravity = 0.0; } - public boolean isAirBlock(BlockPos pos) { + public boolean isAirBlock(LocalPos pos) { return this.getState(pos).getBlock() == Blocks.air; } - public boolean isBlockLoaded(BlockPos pos) { + public boolean isBlockLoaded(LocalPos pos) { return this.isBlockLoaded(pos, true); } - public boolean isBlockLoaded(BlockPos pos, boolean allowEmpty) { + public boolean isBlockLoaded(LocalPos pos, boolean allowEmpty) { return !isValid(pos) ? false : this.isLoaded(pos.getX() >> 4, pos.getZ() >> 4, allowEmpty); } - public boolean isAreaLoaded(BlockPos center, int radius) { + public boolean isAreaLoaded(LocalPos center, int radius) { return this.isAreaLoaded(center, radius, true); } - public boolean isAreaLoaded(BlockPos center, int radius, boolean allowEmpty) { + public boolean isAreaLoaded(LocalPos center, int radius, boolean allowEmpty) { return this.isAreaLoaded(center.getX() - radius, center.getY() - radius, center.getZ() - radius, center.getX() + radius, center.getY() + radius, center.getZ() + radius, allowEmpty); } - public boolean isAreaLoaded(BlockPos from, BlockPos to) { + public boolean isAreaLoaded(LocalPos from, LocalPos to) { return this.isAreaLoaded(from, to, true); } - public boolean isAreaLoaded(BlockPos from, BlockPos to, boolean allowEmpty) { + public boolean isAreaLoaded(LocalPos from, LocalPos to, boolean allowEmpty) { return this.isAreaLoaded(from.getX(), from.getY(), from.getZ(), to.getX(), to.getY(), to.getZ(), allowEmpty); } @@ -160,7 +161,7 @@ public abstract class World implements IWorldAccess { } } - public Chunk getChunk(BlockPos pos) { + public Chunk getChunk(LocalPos pos) { return this.getChunk(pos.getX() >> 4, pos.getZ() >> 4); } @@ -168,7 +169,7 @@ public abstract class World implements IWorldAccess { * Flag 1 will cause a block update Flag 2 will send the change to clients Flag * 4 prevents the block from being re-rendered on client worlds */ - public boolean setState(BlockPos pos, State newState, int flags) { + public boolean setState(LocalPos pos, State newState, int flags) { if(!isValid(pos)) return false; Chunk chunk = this.getChunk(pos); @@ -184,26 +185,26 @@ public abstract class World implements IWorldAccess { return true; } - public void checkBlockLight(BlockPos pos) { + public void checkBlockLight(LocalPos pos) { } - public int getCombinedLight(BlockPos pos) { + public int getCombinedLight(LocalPos pos) { return 0; } - public int getCombinedBrightness(BlockPos pos) { + public int getCombinedBrightness(LocalPos pos) { return 0; } - public boolean setState(BlockPos pos, State state) { + public boolean setState(LocalPos pos, State state) { return this.setState(pos, state, 3); } - public boolean setBlockToAir(BlockPos pos) { + public boolean setBlockToAir(LocalPos pos) { return this.setState(pos, Blocks.air.getState(), 3); } - public boolean destroyBlock(BlockPos pos, boolean dropBlock) { + public boolean destroyBlock(LocalPos pos, boolean dropBlock) { State iblockstate = this.getState(pos); Block block = iblockstate.getBlock(); @@ -231,11 +232,11 @@ public abstract class World implements IWorldAccess { this.clientRenderUpdate(x1, x2, z1, x1, z2, z1); } - public void markBlockRangeForRenderUpdate(BlockPos rangeMin, BlockPos rangeMax) { + public void markBlockRangeForRenderUpdate(LocalPos rangeMin, LocalPos rangeMax) { this.clientRenderUpdate(rangeMin.getX(), rangeMin.getY(), rangeMin.getZ(), rangeMax.getX(), rangeMax.getY(), rangeMax.getZ()); } - public State getState(BlockPos pos) { + public State getState(LocalPos pos) { if(!isValid(pos)) { return Blocks.air.getState(); } @@ -245,7 +246,7 @@ public abstract class World implements IWorldAccess { } } - public BlockPos getBlockTrace(Entity entity, int distance) { + public LocalPos getBlockTrace(Entity entity, int distance) { double range = (double)distance; double theta = 0.2; double yaw = (entity.rotYaw + 90) % 360; @@ -255,19 +256,19 @@ public abstract class World implements IWorldAccess { Vec3 offset = new Vec3(h * Math.cos(Math.toRadians(yaw)), theta * Math.sin(Math.toRadians(pitch)), h * Math.sin(Math.toRadians(yaw))); Vec3 shift = new Vec3(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ); - BlockPos target = new BlockPos(ExtMath.floord(shift.xCoord), ExtMath.floord(shift.yCoord), ExtMath.floord(shift.zCoord)); - BlockPos prev = target; + LocalPos target = new LocalPos(ExtMath.floord(shift.x), ExtMath.floord(shift.y), ExtMath.floord(shift.z)); + LocalPos prev = target; while(true) { prev = target; do { dist += theta; - shift = offset.addVector(shift.xCoord, shift.yCoord, shift.zCoord); - target = new BlockPos(ExtMath.floord(shift.xCoord), ExtMath.floord(shift.yCoord), ExtMath.floord(shift.zCoord)); + shift = offset.add(shift.x, shift.y, shift.z); + target = new LocalPos(ExtMath.floord(shift.x), ExtMath.floord(shift.y), ExtMath.floord(shift.z)); } while(dist <= range && target.getX() == prev.getX() && target.getY() == prev.getY() && target.getZ() == prev.getZ()); if(dist > range) return null; - if(this.getState(new BlockPos(target.getX(), target.getY(), target.getZ())) + if(this.getState(new LocalPos(target.getX(), target.getY(), target.getZ())) .getBlock().getMaterial().blocksMovement()) break; List ents = this.getEntitiesInAABBexcluding(entity, new BoundingBox(target, target.add(1, 1, 1)), @@ -292,15 +293,15 @@ public abstract class World implements IWorldAccess { public HitPosition rayTraceBlocks(Vec3 vec31, Vec3 vec32, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) { - if(!Double.isNaN(vec31.xCoord) && !Double.isNaN(vec31.yCoord) && !Double.isNaN(vec31.zCoord)) { - if(!Double.isNaN(vec32.xCoord) && !Double.isNaN(vec32.yCoord) && !Double.isNaN(vec32.zCoord)) { - int i = ExtMath.floord(vec32.xCoord); - int j = ExtMath.floord(vec32.yCoord); - int k = ExtMath.floord(vec32.zCoord); - int l = ExtMath.floord(vec31.xCoord); - int i1 = ExtMath.floord(vec31.yCoord); - int j1 = ExtMath.floord(vec31.zCoord); - BlockPos blockpos = new BlockPos(l, i1, j1); + if(!Double.isNaN(vec31.x) && !Double.isNaN(vec31.y) && !Double.isNaN(vec31.z)) { + if(!Double.isNaN(vec32.x) && !Double.isNaN(vec32.y) && !Double.isNaN(vec32.z)) { + int i = ExtMath.floord(vec32.x); + int j = ExtMath.floord(vec32.y); + int k = ExtMath.floord(vec32.z); + int l = ExtMath.floord(vec31.x); + int i1 = ExtMath.floord(vec31.y); + int j1 = ExtMath.floord(vec31.z); + LocalPos blockpos = new LocalPos(l, i1, j1); State iblockstate = this.getState(blockpos); Block block = iblockstate.getBlock(); @@ -317,7 +318,7 @@ public abstract class World implements IWorldAccess { int k1 = 200; while(k1-- >= 0) { - if(Double.isNaN(vec31.xCoord) || Double.isNaN(vec31.yCoord) || Double.isNaN(vec31.zCoord)) { + if(Double.isNaN(vec31.x) || Double.isNaN(vec31.y) || Double.isNaN(vec31.z)) { return null; } @@ -365,20 +366,20 @@ public abstract class World implements IWorldAccess { double d3 = 999.0D; double d4 = 999.0D; double d5 = 999.0D; - double d6 = vec32.xCoord - vec31.xCoord; - double d7 = vec32.yCoord - vec31.yCoord; - double d8 = vec32.zCoord - vec31.zCoord; + double d6 = vec32.x - vec31.x; + double d7 = vec32.y - vec31.y; + double d8 = vec32.z - vec31.z; if(flag2) { - d3 = (d0 - vec31.xCoord) / d6; + d3 = (d0 - vec31.x) / d6; } if(flag) { - d4 = (d1 - vec31.yCoord) / d7; + d4 = (d1 - vec31.y) / d7; } if(flag1) { - d5 = (d2 - vec31.zCoord) / d8; + d5 = (d2 - vec31.z) / d8; } if(d3 == -0.0D) { @@ -397,21 +398,21 @@ public abstract class World implements IWorldAccess { if(d3 < d4 && d3 < d5) { enumfacing = i > l ? Facing.WEST : Facing.EAST; - vec31 = new Vec3(d0, vec31.yCoord + d7 * d3, vec31.zCoord + d8 * d3); + vec31 = new Vec3(d0, vec31.y + d7 * d3, vec31.z + d8 * d3); } else if(d4 < d5) { enumfacing = j > i1 ? Facing.DOWN : Facing.UP; - vec31 = new Vec3(vec31.xCoord + d6 * d4, d1, vec31.zCoord + d8 * d4); + vec31 = new Vec3(vec31.x + d6 * d4, d1, vec31.z + d8 * d4); } else { enumfacing = k > j1 ? Facing.NORTH : Facing.SOUTH; - vec31 = new Vec3(vec31.xCoord + d6 * d5, vec31.yCoord + d7 * d5, d2); + vec31 = new Vec3(vec31.x + d6 * d5, vec31.y + d7 * d5, d2); } - l = ExtMath.floord(vec31.xCoord) - (enumfacing == Facing.EAST ? 1 : 0); - i1 = ExtMath.floord(vec31.yCoord) - (enumfacing == Facing.UP ? 1 : 0); - j1 = ExtMath.floord(vec31.zCoord) - (enumfacing == Facing.SOUTH ? 1 : 0); - blockpos = new BlockPos(l, i1, j1); + l = ExtMath.floord(vec31.x) - (enumfacing == Facing.EAST ? 1 : 0); + i1 = ExtMath.floord(vec31.y) - (enumfacing == Facing.UP ? 1 : 0); + j1 = ExtMath.floord(vec31.z) - (enumfacing == Facing.SOUTH ? 1 : 0); + blockpos = new LocalPos(l, i1, j1); State iblockstate1 = this.getState(blockpos); Block block1 = iblockstate1.getBlock(); @@ -500,7 +501,7 @@ public abstract class World implements IWorldAccess { boolean flag = entityIn.isOutsideBorder(); boolean flag1 = this.isInsideBorder(entityIn); State iblockstate = Blocks.stone.getState(); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for(int k1 = i; k1 < j; ++k1) { for(int l1 = i1; l1 < j1; ++l1) { @@ -573,7 +574,7 @@ public abstract class World implements IWorldAccess { int l = ExtMath.floord(bb.maxY + 1.0D); int i1 = ExtMath.floord(bb.minZ); int j1 = ExtMath.floord(bb.maxZ + 1.0D); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for(int k1 = i; k1 < j; ++k1) { for(int l1 = i1; l1 < j1; ++l1) { @@ -607,7 +608,7 @@ public abstract class World implements IWorldAccess { return MOON_PHASES[this.getMoonPhase(0)]; } - public BlockPos getPrecipitationHeight(BlockPos pos) { + public LocalPos getPrecipitationHeight(LocalPos pos) { return this.getChunk(pos).getPrecipitation(pos); } @@ -693,7 +694,7 @@ public abstract class World implements IWorldAccess { TileEntity tileentity = (TileEntity)iterator.next(); if(!tileentity.isInvalid() && tileentity.getWorld() != null) { - BlockPos blockpos = tileentity.getPos(); + LocalPos blockpos = tileentity.getPos(); if(this.isBlockLoaded(blockpos)) { // && this.border.contains(blockpos)) { ((ITickable)tileentity).update(); @@ -872,7 +873,7 @@ public abstract class World implements IWorldAccess { int l = ExtMath.floord(bb.maxY); int i1 = ExtMath.floord(bb.minZ); int j1 = ExtMath.floord(bb.maxZ); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for(int k1 = i; k1 <= j; ++k1) { for(int l1 = k; l1 <= l; ++l1) { @@ -898,7 +899,7 @@ public abstract class World implements IWorldAccess { int j1 = ExtMath.floord(bb.maxZ + 1.0D); if(this.isAreaLoaded(i, k, i1, j, l, j1, true)) { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for(int k1 = i; k1 < j; ++k1) { for(int l1 = k; l1 < l; ++l1) { @@ -930,7 +931,7 @@ public abstract class World implements IWorldAccess { else { boolean flag = false; Vec3 vec3 = new Vec3(0.0D, 0.0D, 0.0D); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for(int k1 = i; k1 < j; ++k1) { for(int l1 = k; l1 < l; ++l1) { @@ -952,12 +953,12 @@ public abstract class World implements IWorldAccess { } } - if(vec3.lengthVector() > 0.0D && entityIn.isPushedByWater()) { + if(vec3.length() > 0.0D && entityIn.isPushedByWater()) { vec3 = vec3.normalize(); double d1 = 0.014D; - entityIn.motionX += vec3.xCoord * d1; - entityIn.motionY += vec3.yCoord * d1; - entityIn.motionZ += vec3.zCoord * d1; + entityIn.motionX += vec3.x * d1; + entityIn.motionY += vec3.y * d1; + entityIn.motionZ += vec3.z * d1; } return flag; @@ -971,7 +972,7 @@ public abstract class World implements IWorldAccess { int l = ExtMath.floord(bb.maxY + 1.0D); int i1 = ExtMath.floord(bb.minZ); int j1 = ExtMath.floord(bb.maxZ + 1.0D); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for(int k1 = i; k1 < j; ++k1) { for(int l1 = k; l1 < l; ++l1) { @@ -993,7 +994,7 @@ public abstract class World implements IWorldAccess { int l = ExtMath.floord(bb.maxY + 1.0D); int i1 = ExtMath.floord(bb.minZ); int j1 = ExtMath.floord(bb.maxZ + 1.0D); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for(int k1 = i; k1 < j; ++k1) { for(int l1 = k; l1 < l; ++l1) { @@ -1054,7 +1055,7 @@ public abstract class World implements IWorldAccess { } } - public boolean extinguishFire(EntityNPC player, BlockPos pos, Facing side) { + public boolean extinguishFire(EntityNPC player, LocalPos pos, Facing side) { pos = pos.offset(side); if(this.getState(pos).getBlock().canExtinguish()) { @@ -1067,7 +1068,7 @@ public abstract class World implements IWorldAccess { } } - public TileEntity getTileEntity(BlockPos pos) { + public TileEntity getTileEntity(LocalPos pos) { if(!isValid(pos)) { return null; } @@ -1104,7 +1105,7 @@ public abstract class World implements IWorldAccess { } } - public void setTileEntity(BlockPos pos, TileEntity tileEntityIn) { + public void setTileEntity(LocalPos pos, TileEntity tileEntityIn) { if(tileEntityIn != null && !tileEntityIn.isInvalid()) { if(this.loadTiles) { tileEntityIn.setPos(pos); @@ -1128,7 +1129,7 @@ public abstract class World implements IWorldAccess { } } - public void removeTileEntity(BlockPos pos) { + public void removeTileEntity(LocalPos pos) { TileEntity tileentity = this.getTileEntity(pos); if(tileentity != null && this.loadTiles) { @@ -1187,31 +1188,31 @@ public abstract class World implements IWorldAccess { this.dimension.getOrbitalPeriod()) * 4L / this.dimension.getOrbitalPeriod())]; } - public float getTemperatureK(BlockPos pos) { + public float getTemperatureK(LocalPos pos) { return this.dimension.isExterminated() ? World.ABSOLUTE_ZERO + 150.0f : Math.max(this.temp + this.getTemperature(pos), 0.0f); } - public float getTemperatureC(BlockPos pos) { + public float getTemperatureC(LocalPos pos) { return World.ABSOLUTE_ZERO + this.getTemperatureK(pos); } - public boolean canFreezeAt(BlockPos pos) { + public boolean canFreezeAt(LocalPos pos) { return this.getTemperatureC(pos) <= 0.0F; } - public boolean canBurnAt(BlockPos pos) { + public boolean canBurnAt(LocalPos pos) { return this.getTemperatureC(pos) >= 194.0f; } - public boolean doesWaterVaporize(BlockPos pos) { + public boolean doesWaterVaporize(LocalPos pos) { return this.getTemperatureC(pos) >= 100.0f; } - public boolean isLavaFaster(BlockPos pos) { + public boolean isLavaFaster(LocalPos pos) { return this.getTemperatureC(pos) >= 314.0f; } - public boolean canSnowAt(BlockPos pos, boolean checkPlace, boolean allowLayers) { + public boolean canSnowAt(LocalPos pos, boolean checkPlace, boolean allowLayers) { if(!this.canFreezeAt(pos)) { return false; } @@ -1292,7 +1293,7 @@ public abstract class World implements IWorldAccess { this.unloaded.addAll(entityCollection); } - public boolean canBlockBePlaced(Block blockIn, BlockPos pos, boolean p_175716_3_, Facing side, Entity entityIn, ItemStack itemStackIn) { + public boolean canBlockBePlaced(Block blockIn, LocalPos pos, boolean p_175716_3_, Facing side, Entity entityIn, ItemStack itemStackIn) { Block block = this.getState(pos).getBlock(); BoundingBox axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBox(this, pos, blockIn.getState()); return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false @@ -1427,7 +1428,7 @@ public abstract class World implements IWorldAccess { return this.hasDownfall() && this.weather.canRain(); } - public boolean isRainingAt(BlockPos strikePosition, boolean wet) { + public boolean isRainingAt(LocalPos strikePosition, boolean wet) { if(wet ? !this.isRaining() : !this.hasDownfall()) { return false; } @@ -1487,7 +1488,7 @@ public abstract class World implements IWorldAccess { return formatEpoch(this.dimension, this.dimension.getEpoch(), false); } - public final void playEffect(int type, BlockPos pos, int data) { + public final void playEffect(int type, LocalPos pos, int data) { this.playEffect(null, type, pos, data); } @@ -1522,14 +1523,14 @@ public abstract class World implements IWorldAccess { public void clientRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) { } - protected void clientNotifyLight(BlockPos pos) { + protected void clientNotifyLight(LocalPos pos) { } - protected abstract float getTemperature(BlockPos pos); + protected abstract float getTemperature(LocalPos 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); + public abstract void markBlockForUpdate(LocalPos pos); protected abstract void onEntityAdded(Entity entityIn); protected abstract void onEntityRemoved(Entity entityIn); - public abstract void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data); + public abstract void playEffect(EntityNPC player, int sfxType, LocalPos blockPosIn, int data); } diff --git a/server/src/main/java/server/Server.java b/server/src/main/java/server/Server.java index 0dece94e..15dcdb68 100755 --- a/server/src/main/java/server/Server.java +++ b/server/src/main/java/server/Server.java @@ -81,7 +81,7 @@ import common.packet.SPacketSkin; import common.packet.SPacketTimeUpdate; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.EncryptUtil; import common.util.ExtMath; import common.util.Pair; @@ -91,7 +91,7 @@ import common.util.Color; import common.util.Triplet; import common.util.Util; import common.util.Var; -import common.util.WorldPos; +import common.util.GlobalPos; import common.vars.Vars; import common.world.World; import server.clipboard.ReorderRegistry; @@ -957,10 +957,10 @@ public final class Server implements IThreadListener, Executor { return Thread.currentThread() == this.thread; } - public Position getRandomSpawnPosition(WorldPos origin) { + public Position getRandomSpawnPosition(GlobalPos origin) { WorldServer world = this.getWorld(origin.getDimension()); world = world == null ? this.space : world; - BlockPos pos = origin; + LocalPos pos = origin; int radius = SVars.spawnRadius; if(radius > 0) { pos = world.getHighestFreePos(pos.add( @@ -968,7 +968,7 @@ public final class Server implements IThreadListener, Executor { ExtMath.clampi(world.rand.excl(-radius, radius), -World.MAX_SIZE + 1, World.MAX_SIZE - 1))); } int y = pos.getY(); - while(world.getState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock().getMaterial().blocksMovement() && y < 511) + while(world.getState(new LocalPos(pos.getX(), y, pos.getZ())).getBlock().getMaterial().blocksMovement() && y < 511) y++; return new Position(pos.getX() + 0.5, (double)y, pos.getZ() + 0.5, -180.0f + world.rand.floatv() * 360.0f, 0.0f, world); } @@ -1007,7 +1007,7 @@ public final class Server implements IThreadListener, Executor { else player.onInitialSpawn(null); if(tag == null) - player.moveToBlockPosAndAngles(new BlockPos(0, 16384, 0), 0.0f, 0.0f); + player.moveToBlockPosAndAngles(new LocalPos(0, 16384, 0), 0.0f, 0.0f); Log.NETWORK.info(loginUser + "[" + connection.getCutAddress() + "] hat sich mit Objekt-ID " + player.getId() + " auf " + UniverseRegistry.getName(world.dimension) + ": " @@ -1108,15 +1108,15 @@ public final class Server implements IThreadListener, Executor { public void recreatePlayer(Player conn) { EntityNPC old = conn.getEntity(); - BlockPos pos = old.getPosition(); + LocalPos pos = old.getPosition(); WorldServer oldWorld = (WorldServer)old.getServerWorld(); oldWorld.removePlayerFromTrackers(old); oldWorld.untrackEntity(old); oldWorld.removePlayer(old); oldWorld.removePlayerEntityDangerously(old); - WorldPos bed = old.getSpawnPoint(); - WorldPos origin = old.getOrigin(); - BlockPos spawn = null; + GlobalPos bed = old.getSpawnPoint(); + GlobalPos origin = old.getOrigin(); + LocalPos spawn = null; String message = null; WorldServer world = bed == null ? this.space : this.getWorld(bed.getDimension()); if(world == null) { @@ -1193,7 +1193,7 @@ public final class Server implements IThreadListener, Executor { nplayer.onInitialSpawn(null); nplayer.setId(old.getId()); if(tag == null) - nplayer.moveToBlockPosAndAngles(new BlockPos(0, 16384, 0), 0.0f, 0.0f); + nplayer.moveToBlockPosAndAngles(new LocalPos(0, 16384, 0), 0.0f, 0.0f); world.loadChunk((int)nplayer.posX >> 4, (int)nplayer.posZ >> 4); world.addPlayer(nplayer); world.spawnEntityInWorld(nplayer); @@ -1212,7 +1212,7 @@ public final class Server implements IThreadListener, Executor { return oldTag; } - public void transferToDimension(EntityNPC player, Dimension dimension, BlockPos pos, float yaw, float pitch, PortalType portal) { + public void transferToDimension(EntityNPC player, Dimension dimension, LocalPos pos, float yaw, float pitch, PortalType portal) { WorldServer oldWorld = (WorldServer)player.getServerWorld(); // this.getWorld(player.dimension); WorldServer newWorld = this.getWorld(dimension); player.connection.sendPacket(new SPacketRespawn(newWorld.dimension, this.time, UniverseRegistry.getName(newWorld.dimension), EntityRegistry.getEntityID(player), player.connection.isInEditor())); @@ -1236,7 +1236,7 @@ public final class Server implements IThreadListener, Executor { player.connection.sendPlayerAbilities(); } - public void placeInDimension(Entity entity, WorldServer oldWorld, WorldServer world, BlockPos pos, PortalType portal) { + public void placeInDimension(Entity entity, WorldServer oldWorld, WorldServer world, LocalPos pos, PortalType portal) { double newX = entity.posX; double newY = entity.posY; double newZ = entity.posZ; @@ -1248,7 +1248,7 @@ public final class Server implements IThreadListener, Executor { newZ = ((double)pos.getZ()) + 0.5; } else { - pos = world.getHighestFreePos(new BlockPos(newX, 0, newZ)); + pos = world.getHighestFreePos(new LocalPos(newX, 0, newZ)); newX = ((double)pos.getX()) + 0.5; newY = (double)pos.getY(); newZ = ((double)pos.getZ()) + 0.5; @@ -1262,7 +1262,7 @@ public final class Server implements IThreadListener, Executor { if(entity.isEntityAlive()) { entity.setLocationAndAngles(newX, entity.posY, newZ, entity.rotYaw, entity.rotPitch); if(portal != null) - world.makePortal(new BlockPos(ExtMath.floord(entity.posX) + world.makePortal(new LocalPos(ExtMath.floord(entity.posX) ,ExtMath.floord(entity.posY) ,ExtMath.floord(entity.posZ)), 128, portal); } diff --git a/server/src/main/java/server/clipboard/ClipboardPlacer.java b/server/src/main/java/server/clipboard/ClipboardPlacer.java index 33d21101..143a1d62 100755 --- a/server/src/main/java/server/clipboard/ClipboardPlacer.java +++ b/server/src/main/java/server/clipboard/ClipboardPlacer.java @@ -16,16 +16,16 @@ import common.collect.Lists; import common.init.Blocks; import common.inventory.IInventory; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Vec3i; import server.world.WorldServer; public class ClipboardPlacer { private static class BlockEntry { - private final BlockPos pos; + private final LocalPos pos; private final ClipboardBlock block; - private BlockEntry(BlockPos pos, ClipboardBlock block) { + private BlockEntry(LocalPos pos, ClipboardBlock block) { this.pos = pos; this.block = block; } @@ -40,7 +40,7 @@ public class ClipboardPlacer { this.world = world; } - public void setBlock(BlockPos location, ClipboardBlock block) { + public void setBlock(LocalPos location, ClipboardBlock block) { Block type = block.getState().getBlock(); if (ReorderRegistry.shouldPlaceLast(type)) { // Place torches, etc. last @@ -57,7 +57,7 @@ public class ClipboardPlacer { } } - private boolean setBlockQuirk(BlockPos location, ClipboardBlock block) { + private boolean setBlockQuirk(LocalPos location, ClipboardBlock block) { Block existing = this.world.getState(location).getBlock(); if (existing instanceof ITileEntityProvider) { TileEntity tile = this.world.getTileEntity(location); @@ -90,8 +90,8 @@ public class ClipboardPlacer { } this.stage2.clear(); - final Set blocks = new HashSet(); - final Map blockTypes = new HashMap(); + final Set blocks = new HashSet(); + final Map blockTypes = new HashMap(); for(BlockEntry entry : this.stage3) { // final BlockPos pt = entry.getKey(); blocks.add(entry.pos); @@ -100,12 +100,12 @@ public class ClipboardPlacer { this.stage3.clear(); while (!blocks.isEmpty()) { - BlockPos current = blocks.iterator().next(); + LocalPos current = blocks.iterator().next(); if (!blocks.contains(current)) { continue; } - final Deque walked = new LinkedList(); + final Deque walked = new LinkedList(); while (true) { walked.addFirst(current); @@ -119,7 +119,7 @@ public class ClipboardPlacer { if(type instanceof BlockDoor) { if (baseBlock.getState().getValue(BlockDoor.HALF) == BlockDoor.EnumDoorHalf.LOWER) { // Deal with lower door halves being attached to the floor AND the upper half - BlockPos upperBlock = current.add(0, 1, 0); + LocalPos upperBlock = current.add(0, 1, 0); if (blocks.contains(upperBlock) && !walked.contains(upperBlock)) { walked.addFirst(upperBlock); } @@ -128,7 +128,7 @@ public class ClipboardPlacer { else if(type instanceof BlockRail) { // Here, rails are hardcoded to be attached to the block below them. // They're also attached to the block they're ascending towards via BlockType.getAttachment. - BlockPos lowerBlock = current.add(0, -1, 0); + LocalPos lowerBlock = current.add(0, -1, 0); if (blocks.contains(lowerBlock) && !walked.contains(lowerBlock)) { walked.addFirst(lowerBlock); } @@ -154,7 +154,7 @@ public class ClipboardPlacer { } } - for(BlockPos pt : walked) { + for(LocalPos pt : walked) { this.setBlockQuirk(pt, blockTypes.get(pt)); blocks.remove(pt); } diff --git a/server/src/main/java/server/command/Command.java b/server/src/main/java/server/command/Command.java index 42161e40..2f96bea9 100644 --- a/server/src/main/java/server/command/Command.java +++ b/server/src/main/java/server/command/Command.java @@ -7,7 +7,7 @@ import java.util.Map; import common.collect.Lists; import common.collect.Maps; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.CharValidator; import common.util.Color; import common.util.Vec3; @@ -92,12 +92,12 @@ public abstract class Command implements Executable { protected Command addBlockPos(String name, boolean defaulted) { return this.addParameter(name, new ArgCombiner() { - public BlockPos combine(Integer[] values) { - return new BlockPos(values[0], values[1], values[2]); + public LocalPos combine(Integer[] values) { + return new LocalPos(values[0], values[1], values[2]); } public Class getTypeClass() { - return BlockPos.class; + return LocalPos.class; } public Class getInputClass() { diff --git a/server/src/main/java/server/command/DoubleParser.java b/server/src/main/java/server/command/DoubleParser.java index 2aa28a26..8b649bb3 100644 --- a/server/src/main/java/server/command/DoubleParser.java +++ b/server/src/main/java/server/command/DoubleParser.java @@ -3,7 +3,7 @@ package server.command; import java.util.Collection; import common.collect.Lists; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Position; public class DoubleParser extends DefaultingParser { @@ -87,7 +87,7 @@ public class DoubleParser extends DefaultingParser { } public Collection getCompletions(CommandEnvironment env, String last) { - BlockPos pos = this.defType == null ? null : env.getExecutor().getPointedPosition(); + LocalPos pos = this.defType == null ? null : env.getExecutor().getPointedPosition(); if(this.defType != null) switch(this.defType) { case X: diff --git a/server/src/main/java/server/command/Executor.java b/server/src/main/java/server/command/Executor.java index e6289871..fb5d3e51 100644 --- a/server/src/main/java/server/command/Executor.java +++ b/server/src/main/java/server/command/Executor.java @@ -1,7 +1,7 @@ package server.command; import common.entity.Entity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Position; public interface Executor { @@ -13,7 +13,7 @@ public interface Executor { return null; } - default BlockPos getPointedPosition() { + default LocalPos getPointedPosition() { return null; } diff --git a/server/src/main/java/server/command/IntParser.java b/server/src/main/java/server/command/IntParser.java index bbccec64..63ed208f 100644 --- a/server/src/main/java/server/command/IntParser.java +++ b/server/src/main/java/server/command/IntParser.java @@ -3,7 +3,7 @@ package server.command; import java.util.Collection; import common.collect.Lists; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Position; @@ -82,7 +82,7 @@ public class IntParser extends DefaultingParser { } public Collection getCompletions(CommandEnvironment env, String last) { - BlockPos pos = this.defType == null ? null : env.getExecutor().getPointedPosition(); + LocalPos pos = this.defType == null ? null : env.getExecutor().getPointedPosition(); if(this.defType != null) switch(this.defType) { case X: diff --git a/server/src/main/java/server/command/commands/CommandBlock.java b/server/src/main/java/server/command/commands/CommandBlock.java index ada18702..b5c9128a 100644 --- a/server/src/main/java/server/command/commands/CommandBlock.java +++ b/server/src/main/java/server/command/commands/CommandBlock.java @@ -8,7 +8,7 @@ import common.collect.Lists; import common.init.BlockRegistry; import common.tags.TagObject; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.command.Command; import server.command.CommandEnvironment; @@ -39,7 +39,7 @@ public class CommandBlock extends Command { this.addTag("tag", 't'); } - public Object exec(CommandEnvironment env, Executor exec, String block, BlockPos position, WorldServer world, TagObject tag) { + public Object exec(CommandEnvironment env, Executor exec, String block, LocalPos position, WorldServer world, TagObject tag) { State state = BlockRegistry.byName(block, null); if(state == null) throw new RunException("Block '%s' existiert nicht", block); diff --git a/server/src/main/java/server/command/commands/CommandCamera.java b/server/src/main/java/server/command/commands/CommandCamera.java index 3d6b3520..e11811b0 100644 --- a/server/src/main/java/server/command/commands/CommandCamera.java +++ b/server/src/main/java/server/command/commands/CommandCamera.java @@ -28,6 +28,6 @@ public class CommandCamera extends Command { } public void exec(CommandEnvironment env, Executor exec, Vec3 position, Dimension dim, double yaw, double pitch, int radius, double speed, CameraType type, boolean fixed, Player player) { - player.setCamera(dim, position.xCoord, position.yCoord, position.zCoord, (float)yaw, (float)pitch, radius, (float)speed, type, fixed); + player.setCamera(dim, position.x, position.y, position.z, (float)yaw, (float)pitch, radius, (float)speed, type, fixed); } } diff --git a/server/src/main/java/server/command/commands/CommandDelwarp.java b/server/src/main/java/server/command/commands/CommandDelwarp.java index 5a236a8d..6706f030 100644 --- a/server/src/main/java/server/command/commands/CommandDelwarp.java +++ b/server/src/main/java/server/command/commands/CommandDelwarp.java @@ -20,6 +20,6 @@ public class CommandDelwarp extends Command { throw new RunException("Warp '%s' existiert nicht", warp); Position pos = env.getServer().getWarps().remove(warp); Dimension wdim = pos.getDimension(); - exec.log("Warp %s bei %d, %d, %d in %s entfernt", warp, ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), wdim == null ? "" : wdim.getDisplay()); + exec.log("Warp %s bei %d, %d, %d in %s entfernt", warp, ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), wdim == null ? "" : wdim.getDisplay()); } } diff --git a/server/src/main/java/server/command/commands/CommandEffect.java b/server/src/main/java/server/command/commands/CommandEffect.java index 0d54c255..50e7b030 100644 --- a/server/src/main/java/server/command/commands/CommandEffect.java +++ b/server/src/main/java/server/command/commands/CommandEffect.java @@ -22,7 +22,7 @@ public class CommandEffect extends Command { public void exec(CommandEnvironment env, Executor exec, List players, ParticleType type, Vec3 pos) { for(Player player : players) { - player.sendPacket(new SPacketParticles(type, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, 0)); + player.sendPacket(new SPacketParticles(type, (float)pos.x, (float)pos.y, (float)pos.z, 0)); } } } diff --git a/server/src/main/java/server/command/commands/CommandEntity.java b/server/src/main/java/server/command/commands/CommandEntity.java index 04a7e34f..d7000580 100644 --- a/server/src/main/java/server/command/commands/CommandEntity.java +++ b/server/src/main/java/server/command/commands/CommandEntity.java @@ -4,7 +4,7 @@ import java.util.List; import common.entity.Entity; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -23,7 +23,7 @@ public class CommandEntity extends Command { int done = 0; for(Entity entity : entities) { if(entity.isEntityAlive()) { - BlockPos pos = entity.getPosition(); + LocalPos pos = entity.getPosition(); TagObject etag = new TagObject(); entity.writeTags(etag); if(tag == null) { diff --git a/server/src/main/java/server/command/commands/CommandExplode.java b/server/src/main/java/server/command/commands/CommandExplode.java index c3ab5a74..238f9d62 100644 --- a/server/src/main/java/server/command/commands/CommandExplode.java +++ b/server/src/main/java/server/command/commands/CommandExplode.java @@ -24,9 +24,9 @@ public class CommandExplode extends Command { public void exec(CommandEnvironment env, Executor exec, Vec3 pos, WorldServer world, int radius, boolean ticked, boolean fire, boolean noblocks, boolean altsound) { if(ticked) - world.explodeTicked(null, pos.xCoord, pos.yCoord, pos.zCoord, radius); + world.explodeTicked(null, pos.x, pos.y, pos.z, radius); else - world.explode(null, null, pos.xCoord, pos.yCoord, pos.zCoord, radius, fire, !noblocks, altsound); - exec.log("Explosion bei %d, %d, %d in %s erzeugt", ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getDisplay()); + world.explode(null, null, pos.x, pos.y, pos.z, radius, fire, !noblocks, altsound); + exec.log("Explosion bei %d, %d, %d in %s erzeugt", ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), world.dimension.getDisplay()); } } diff --git a/server/src/main/java/server/command/commands/CommandFind.java b/server/src/main/java/server/command/commands/CommandFind.java index 27f61c4f..3665e32f 100644 --- a/server/src/main/java/server/command/commands/CommandFind.java +++ b/server/src/main/java/server/command/commands/CommandFind.java @@ -3,7 +3,7 @@ package server.command.commands; import java.util.List; import common.entity.Entity; -import common.util.BlockPos; +import common.util.LocalPos; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -20,7 +20,7 @@ public class CommandFind extends Command { int done = 0; for(Entity entity : entities) { if(entity.isEntityAlive()) { - BlockPos pos = entity.getPosition(); + LocalPos pos = entity.getPosition(); exec.log("%s bei %d, %d, %d in %s gefunden %s", entity.getRawName(), pos.getX(), pos.getY(), pos.getZ(), entity.worldObj.dimension.getDisplay(), asCommand(null, "tp #%d", entity.getId())); done++; diff --git a/server/src/main/java/server/command/commands/CommandSet.java b/server/src/main/java/server/command/commands/CommandSet.java index 59c8e238..5909347c 100644 --- a/server/src/main/java/server/command/commands/CommandSet.java +++ b/server/src/main/java/server/command/commands/CommandSet.java @@ -8,7 +8,7 @@ import common.collect.Lists; import common.init.BlockRegistry; import common.tags.TagObject; import common.tileentity.TileEntity; -import common.util.BlockPos.MutableBlockPos; +import common.util.MutablePos; import common.world.State; import server.command.Command; import server.command.CommandEnvironment; @@ -41,7 +41,7 @@ public class CommandSet extends Command { if(!exec.isPlayer() || ((Player)exec).getPresentEntity() == null) throw new RunException("Nur Spieler können diesen Befehl ausführen"); Player player = (Player)exec; - Iterable blocks = player.getSelectedBlocks(); + Iterable blocks = player.getSelectedBlocks(); if(blocks == null) throw new RunException("Es ist keine Auswahl vorhanden"); State state; @@ -59,7 +59,7 @@ public class CommandSet extends Command { } WorldServer world = (WorldServer)player.getPresentEntity().getServerWorld(); int changed = 0; - for(MutableBlockPos pos : blocks) { + for(MutablePos pos : blocks) { boolean success = world.setState(pos, state); if(tag != null) { TileEntity tile = world.getTileEntity(pos); diff --git a/server/src/main/java/server/command/commands/CommandSetwarp.java b/server/src/main/java/server/command/commands/CommandSetwarp.java index 9605df3f..da790d0e 100644 --- a/server/src/main/java/server/command/commands/CommandSetwarp.java +++ b/server/src/main/java/server/command/commands/CommandSetwarp.java @@ -28,13 +28,13 @@ public class CommandSetwarp extends Command { Position pos = env.getServer().getWarps().get(warp); Dimension wdim = pos.getDimension(); if(wdim != null) - exec.log("Alte Position %d, %d, %d in %s entfernt", ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), dim.getDisplay()); + exec.log("Alte Position %d, %d, %d in %s entfernt", ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), dim.getDisplay()); } else { throw new RunException("Warp '%s' existiert bereits", warp); } } - env.getServer().getWarps().put(warp, new Position(position.xCoord, position.yCoord, position.zCoord, yaw == null ? 0.0f : yaw.floatValue(), pitch == null ? 0.0f : pitch.floatValue(), dim)); - exec.log("Warp '%s' auf %d, %d, %d in %s gesetzt", warp, ExtMath.floord(position.xCoord), ExtMath.floord(position.yCoord), ExtMath.floord(position.zCoord), dim.getDisplay()); + env.getServer().getWarps().put(warp, new Position(position.x, position.y, position.z, yaw == null ? 0.0f : yaw.floatValue(), pitch == null ? 0.0f : pitch.floatValue(), dim)); + exec.log("Warp '%s' auf %d, %d, %d in %s gesetzt", warp, ExtMath.floord(position.x), ExtMath.floord(position.y), ExtMath.floord(position.z), dim.getDisplay()); } } diff --git a/server/src/main/java/server/command/commands/CommandShowwarp.java b/server/src/main/java/server/command/commands/CommandShowwarp.java index 69aef704..46be2c9e 100644 --- a/server/src/main/java/server/command/commands/CommandShowwarp.java +++ b/server/src/main/java/server/command/commands/CommandShowwarp.java @@ -19,6 +19,6 @@ public class CommandShowwarp extends Command { throw new RunException("Warp '%s' existiert nicht", warp); Position pos = env.getServer().getWarps().get(warp); Dimension wdim = pos.getDimension(); - exec.log("Warp %s ist bei %.2f, %.2f, %.2f [%.1f, %.1f] in %s", warp, pos.xCoord, pos.yCoord, pos.zCoord, pos.yaw(), pos.pitch(), wdim == null ? "" : wdim.getDisplay()); + exec.log("Warp %s ist bei %.2f, %.2f, %.2f [%.1f, %.1f] in %s", warp, pos.x, pos.y, pos.z, pos.yaw(), pos.pitch(), wdim == null ? "" : wdim.getDisplay()); } } diff --git a/server/src/main/java/server/command/commands/CommandSpawn.java b/server/src/main/java/server/command/commands/CommandSpawn.java index 876d3a6f..52c9aea1 100644 --- a/server/src/main/java/server/command/commands/CommandSpawn.java +++ b/server/src/main/java/server/command/commands/CommandSpawn.java @@ -52,11 +52,11 @@ public class CommandSpawn extends Command { catch(NumberFormatException e) { } } - world.strikeLightning(pos.xCoord, pos.yCoord, pos.zCoord, color, + world.strikeLightning(pos.x, pos.y, pos.z, color, tag != null && tag.hasInt("damage") ? tag.getInt("damage") : 0, tag != null && tag.hasBool("fire") && tag.getBool("fire"), exec.isPlayer() && tag != null && tag.hasBool("summoned") && tag.getBool("summoned") ? ((Player)exec).getPresentEntity() : null); } - exec.log("%sBlitz bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getDisplay()); + exec.log("%sBlitz bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), world.dimension.getDisplay()); return null; } else { @@ -65,7 +65,7 @@ public class CommandSpawn extends Command { Entity entity = EntityRegistry.createEntityByName(type, world); if(entity == null) throw new RunException("Objekt konnte nicht erzeugt werden"); - entity.setLocationAndAngles(pos.xCoord, pos.yCoord, pos.zCoord, world.rand.floatv() * 360.0f, 0.0f); + entity.setLocationAndAngles(pos.x, pos.y, pos.z, world.rand.floatv() * 360.0f, 0.0f); if(tag != null) { TagObject ent = new TagObject(); entity.writeTags(ent); @@ -83,7 +83,7 @@ public class CommandSpawn extends Command { } spawned.add("#" + entity.getId()); } - exec.log("%s%s bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), EntityRegistry.getEntityName(type), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord), world.dimension.getDisplay()); + exec.log("%s%s bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), EntityRegistry.getEntityName(type), ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z), world.dimension.getDisplay()); return Util.buildLines(",", spawned); } } diff --git a/server/src/main/java/server/command/commands/CommandTele.java b/server/src/main/java/server/command/commands/CommandTele.java index 9ccc1977..1628219a 100644 --- a/server/src/main/java/server/command/commands/CommandTele.java +++ b/server/src/main/java/server/command/commands/CommandTele.java @@ -27,8 +27,8 @@ public class CommandTele extends Command { public Object exec(CommandEnvironment env, Executor exec, Vec3 position, Dimension dim, Double yaw, Double pitch, List entities) { for(Entity entity : entities) { - entity.teleport(position.xCoord, position.yCoord, position.zCoord, yaw == null ? entity.rotYaw : yaw.floatValue(), pitch == null ? entity.rotPitch : pitch.floatValue(), dim); - exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getRawName(), ExtMath.floord(position.xCoord), ExtMath.floord(position.yCoord), ExtMath.floord(position.zCoord), dim.getDisplay()); + entity.teleport(position.x, position.y, position.z, yaw == null ? entity.rotYaw : yaw.floatValue(), pitch == null ? entity.rotPitch : pitch.floatValue(), dim); + exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getRawName(), ExtMath.floord(position.x), ExtMath.floord(position.y), ExtMath.floord(position.z), dim.getDisplay()); } return entities.size(); } diff --git a/server/src/main/java/server/command/commands/CommandWarps.java b/server/src/main/java/server/command/commands/CommandWarps.java index 284c1d32..95984694 100644 --- a/server/src/main/java/server/command/commands/CommandWarps.java +++ b/server/src/main/java/server/command/commands/CommandWarps.java @@ -40,7 +40,7 @@ public class CommandWarps extends Command { Position pos = warp.getValue(); Dimension wdim = pos.getDimension(); if(wdim != null && (dim == null || wdim == dim)) - exec.log(Color.NEON + "%s" + Color.GRAY + ": " + Color.ORANGE + "%s" + (dim == null ? " @ " : "") + "%d, %d, %d", warp.getKey(), dim != null ? "" : wdim.getDisplay(), ExtMath.floord(pos.xCoord), ExtMath.floord(pos.yCoord), ExtMath.floord(pos.zCoord)); + exec.log(Color.NEON + "%s" + Color.GRAY + ": " + Color.ORANGE + "%s" + (dim == null ? " @ " : "") + "%d, %d, %d", warp.getKey(), dim != null ? "" : wdim.getDisplay(), ExtMath.floord(pos.x), ExtMath.floord(pos.y), ExtMath.floord(pos.z)); } } } diff --git a/server/src/main/java/server/command/commands/CommandWorld.java b/server/src/main/java/server/command/commands/CommandWorld.java index c747c15b..28968ae6 100644 --- a/server/src/main/java/server/command/commands/CommandWorld.java +++ b/server/src/main/java/server/command/commands/CommandWorld.java @@ -3,7 +3,7 @@ package server.command.commands; import java.util.List; import common.entity.Entity; -import common.util.BlockPos; +import common.util.LocalPos; import server.command.Command; import server.command.CommandEnvironment; import server.command.Executor; @@ -21,15 +21,15 @@ public class CommandWorld extends Command { public Object exec(CommandEnvironment env, Executor exec, WorldServer world, List entities) { for(Entity entity : entities) { - BlockPos pos = adjust(world, entity.getPosition()); + LocalPos pos = adjust(world, entity.getPosition()); entity.teleport(pos, world); exec.log("%s nach %d, %d, %d in %s teleportiert", entity.getRawName(), pos.getX(), pos.getY(), pos.getZ(), world.dimension.getDisplay()); } return entities.size(); } - public static BlockPos adjust(WorldServer world, BlockPos pos) { - pos = pos.getY() < 0 ? new BlockPos(pos.getX(), 0, pos.getZ()) : pos; + public static LocalPos adjust(WorldServer world, LocalPos pos) { + pos = pos.getY() < 0 ? new LocalPos(pos.getX(), 0, pos.getZ()) : pos; if(world.getState(pos).getBlock().getMaterial().blocksMovement() || world.getState(pos).getBlock().getMaterial().isLiquid()) { while((world.getState(pos).getBlock().getMaterial().blocksMovement() || world.getState(pos).getBlock().getMaterial().isLiquid()) && pos.getY() < 511) pos = pos.up(); diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index 6cd7aa49..3e44b3cf 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -107,19 +107,19 @@ import common.tileentity.TileEntity; import common.tileentity.TileEntityChest; import common.tileentity.Device; import common.tileentity.TileEntitySign; -import common.util.BlockPos; -import common.util.BlockPos.MutableBlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ChunkPos; import common.util.ExtMath; import common.util.Facing; import common.util.IntHashMap; +import common.util.MutablePos; import common.util.PortalType; import common.util.Position; import common.util.Color; import common.util.Equipment; import common.util.Vec3i; -import common.util.WorldPos; +import common.util.GlobalPos; import common.vars.Vars; import common.village.MerchantRecipeList; import common.world.BlockArray; @@ -180,13 +180,13 @@ public class Player extends User implements Executor, IPlayer private int rotation; private boolean flipX; private boolean flipZ; - private BlockPos selPos1; - private BlockPos selPos2; + private LocalPos selPos1; + private LocalPos selPos2; private Vec3i selOffset; private EditAction edit = EditAction.SELECT; - private BlockPos startPos = BlockPos.ORIGIN; - private BlockPos removingPos = BlockPos.ORIGIN; + private LocalPos startPos = LocalPos.ORIGIN; + private LocalPos removingPos = LocalPos.ORIGIN; private boolean isDestroyingBlock; private boolean receivedFinishDiggingPacket; private int initialDamage; @@ -207,7 +207,7 @@ public class Player extends User implements Executor, IPlayer private int itemUseCooldown; private int pointedEntity; - private BlockPos pointedPosition; + private LocalPos pointedPosition; private final List loadedChunks = new LinkedList(); private final List destroyedItemsNetCache = new LinkedList(); @@ -421,7 +421,7 @@ public class Player extends User implements Executor, IPlayer int i = ExtMath.floord(this.entity.posX); int j = ExtMath.floord(this.entity.posY - 0.20000000298023224D); int k = ExtMath.floord(this.entity.posZ); - BlockPos blockpos = new BlockPos(i, j, k); + LocalPos blockpos = new LocalPos(i, j, k); Block block = this.entity.worldObj.getState(blockpos).getBlock(); if (block == Blocks.air) @@ -665,7 +665,7 @@ public class Player extends User implements Executor, IPlayer this.lastExperience = -1; } - public void travelToDimension(Dimension dimensionId, BlockPos pos, float yaw, float pitch, PortalType portal) + public void travelToDimension(Dimension dimensionId, LocalPos pos, float yaw, float pitch, PortalType portal) { if(this.camera != null) return; @@ -684,7 +684,7 @@ public class Player extends User implements Executor, IPlayer this.entity.unmount(); // this.mountEntity(null); if(this.entity.worldObj.dimension != dimension) - this.travelToDimension(dimension, new BlockPos(x, y, z), yaw, pitch, null); + this.travelToDimension(dimension, new LocalPos(x, y, z), yaw, pitch, null); this.setPlayerLocation(x, y, z, yaw, pitch); this.entity.setRotationYawHead(yaw); } @@ -904,7 +904,7 @@ public class Player extends User implements Executor, IPlayer { int x = (chunk.xPos << 4) | (n >> 4); int z = (chunk.zPos << 4) | (n & 15); - int temp = Float.floatToIntBits(gen == null ? 0.0f : gen.getBiomeAt(new BlockPos(x, 0, z)).temperature); + int temp = Float.floatToIntBits(gen == null ? 0.0f : gen.getBiomeAt(new LocalPos(x, 0, z)).temperature); int off = Float.floatToIntBits(world.getTempNoise(x, z)); dataset.data[j++] = (byte)(temp & 255); dataset.data[j++] = (byte)(temp >> 8 & 255); @@ -996,7 +996,7 @@ public class Player extends User implements Executor, IPlayer if (chunkcoordintpair != null) { - if (world.isBlockLoaded(new BlockPos(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4))) + if (world.isBlockLoaded(new LocalPos(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4))) { ChunkServer chunk = world.getChunk(chunkcoordintpair.x, chunkcoordintpair.z); @@ -1100,7 +1100,7 @@ public class Player extends User implements Executor, IPlayer } } - public void onBlockClicked(BlockPos pos, Facing side) + public void onBlockClicked(LocalPos pos, Facing side) { if(this.onPlayerInteract(true, pos)) { this.sendPacket(new SPacketBlockChange(this.entity.worldObj, pos)); @@ -1145,7 +1145,7 @@ public class Player extends User implements Executor, IPlayer // } } - public void blockRemoving(BlockPos pos) + public void blockRemoving(LocalPos pos) { if (pos.equals(this.startPos)) { @@ -1177,7 +1177,7 @@ public class Player extends User implements Executor, IPlayer this.isDestroyingBlock = false; } - private boolean removeBlock(BlockPos pos) + private boolean removeBlock(LocalPos pos) { State iblockstate = this.entity.worldObj.getState(pos); iblockstate.getBlock().preBroken(this.entity.worldObj, pos, iblockstate, this.entity); @@ -1191,7 +1191,7 @@ public class Player extends User implements Executor, IPlayer return flag; } - private boolean tryHarvestBlock(BlockPos pos) + private boolean tryHarvestBlock(LocalPos pos) { // if (this.getHeldItem() != null && !this.getHeldItem().getItem().canBreakBlocks()) // { @@ -1259,7 +1259,7 @@ public class Player extends User implements Executor, IPlayer } } - public boolean activateBlockOrUseItem(ItemStack stack, BlockPos pos, Facing side, float offsetX, float offsetY, float offsetZ) + public boolean activateBlockOrUseItem(ItemStack stack, LocalPos pos, Facing side, float offsetX, float offsetY, float offsetZ) { if(this.onPlayerInteract(false, pos)) { this.sendPacket(new SPacketBlockChange(this.entity.worldObj, pos)); @@ -1300,7 +1300,7 @@ public class Player extends User implements Executor, IPlayer } - public void setSelection(boolean primary, BlockPos pos) { + public void setSelection(boolean primary, LocalPos pos) { switch(this.edit) { case SELECT: if(primary) @@ -1322,34 +1322,34 @@ public class Player extends User implements Executor, IPlayer } } - private boolean onPlayerInteract(boolean primary, BlockPos pos) { + private boolean onPlayerInteract(boolean primary, LocalPos pos) { if(this.entity.getHeldItem() != null && this.entity.getHeldItem().getItem().onAction(this.entity.getHeldItem(), this.entity, this.entity.worldObj, primary ? ItemControl.PRIMARY : ItemControl.SECONDARY, pos)) return true; return false; } - private void selectPos1(BlockPos pos) { - BlockPos point = pos == null ? this.entity.getPosition() : pos; + private void selectPos1(LocalPos pos) { + LocalPos point = pos == null ? this.entity.getPosition() : pos; String msg = this.selectPoint(point, false); if(msg != null) this.addHotbar(Color.DARK_RED + msg); } - private void selectPos2(BlockPos pos) { - BlockPos point = pos == null ? this.entity.getPosition() : pos; + private void selectPos2(LocalPos pos) { + LocalPos point = pos == null ? this.entity.getPosition() : pos; String msg = this.selectPoint(point, true); if(msg != null) this.addHotbar(Color.MIDNIGHT + msg); } - private String selectPoint(BlockPos position, boolean second) { + private String selectPoint(LocalPos position, boolean second) { if(this.selectionDim == Integer.MIN_VALUE || this.selectionDim != UniverseRegistry.getId(this.entity.worldObj.dimension)) { this.selectionDim = UniverseRegistry.getId(this.entity.worldObj.dimension); this.selPos1 = null; this.selPos2 = null; } // this.setSelectionWorld(); - BlockPos current = second ? this.selPos2 : this.selPos1; + LocalPos current = second ? this.selPos2 : this.selPos1; if(current != null && (position.compareTo(current) == 0)) return null; if(second) @@ -1401,7 +1401,7 @@ public class Player extends User implements Executor, IPlayer int nx = this.clipboard.length; int ny = this.clipboard[0].length; int nz = this.clipboard[0][0].length; - BlockPos to = this.entity.getPosition(); + LocalPos to = this.entity.getPosition(); ClipboardPlacer placer = new ClipboardPlacer(this.getEntityWorld()); Mat2i transform = null; if(this.rotation != 0 || this.flipX || this.flipZ) { @@ -1470,11 +1470,11 @@ public class Player extends User implements Executor, IPlayer return newValue; } - public Iterable getSelectedBlocks() { + public Iterable getSelectedBlocks() { if(this.selectionDim == Integer.MIN_VALUE || this.selectionDim != UniverseRegistry.getId(this.entity.worldObj.dimension) || this.selPos1 == null || this.selPos2 == null) return null; - return BlockPos.getAllInBoxMutable(this.selPos1, this.selPos2); + return MutablePos.mutableArea(this.selPos1, this.selPos2); } private boolean copyClipboard() { @@ -1492,13 +1492,13 @@ public class Player extends User implements Executor, IPlayer for(int x = mx; x <= nx; x++) { for(int y = my; y <= ny; y++) { for(int z = mz; z <= nz; z++) { - this.clipboard[x - mx][y - my][z - mz] = source.getBlock(new BlockPos(x, y, z)); + this.clipboard[x - mx][y - my][z - mz] = source.getBlock(new LocalPos(x, y, z)); } } } this.rotation = 0; this.flipX = this.flipZ = false; - BlockPos pos = this.entity.getPosition(); + LocalPos pos = this.entity.getPosition(); this.selOffset = new Vec3i(mx - pos.getX(), my - pos.getY(), mz - pos.getZ()); this.addHotbar(Color.YELLOW + "Auswahl wurde in die Zwischenablage kopiert"); return true; @@ -1584,7 +1584,7 @@ public class Player extends User implements Executor, IPlayer Alignment align = Alignment.getByName(tag.getString("Align")); Dimension dimension = UniverseRegistry.getDimension(tag.getString("Dimension")); String dim = dimension == null ? "???" : dimension.getDisplay(); - BlockPos pos = new BlockPos(tag.getDouble("PosX"), tag.getDouble("PosY"), tag.getDouble("PosZ")); + LocalPos pos = new LocalPos(tag.getDouble("PosX"), tag.getDouble("PosY"), tag.getDouble("PosZ")); String type = EntityRegistry.getEntityName(tag.getString("id")); int level = tag.getInt("XpLevel"); Dimension origin = UniverseRegistry.getDimension(tag.getString("OriginDim")); @@ -1899,7 +1899,7 @@ public class Player extends User implements Executor, IPlayer return this.pointedEntity != -1 && this.entity != null ? this.entity.worldObj.getEntityByID(this.pointedEntity) : null; } - public BlockPos getPointedPosition() { + public LocalPos getPointedPosition() { return this.pointedPosition; } @@ -2249,7 +2249,7 @@ public class Player extends User implements Executor, IPlayer if(this.charEditor || this.entity instanceof EntityCameraHolder) return; WorldServer worldserver = this.getEntityWorld(); // this.serverController.getWorld(this.playerEntity.dimension); - BlockPos blockpos = packetIn.getPosition(); + LocalPos blockpos = packetIn.getPosition(); switch (packetIn.getStatus()) { @@ -2337,7 +2337,7 @@ public class Player extends User implements Executor, IPlayer WorldServer worldserver = this.getEntityWorld(); // this.serverController.getWorld(this.playerEntity.dimension); ItemStack itemstack = this.entity.getHeldItem(); boolean flag = false; - BlockPos blockpos = packetIn.getPosition(); + LocalPos blockpos = packetIn.getPosition(); Facing enumfacing = Facing.getFront(packetIn.getPlacedBlockDirection()); if (packetIn.getPlacedBlockDirection() == 255) @@ -2466,7 +2466,7 @@ public class Player extends User implements Executor, IPlayer this.characters.add(new TagObject()); WorldServer world = this.server.getWorld(UniverseRegistry.getDimension(packetIn.getAuxData())); world = world == null ? this.server.getSpace() : world; - WorldPos origin = new WorldPos(world.rand.range(-SVars.originRadius, SVars.originRadius), 64, world.rand.range(-SVars.originRadius, SVars.originRadius), world); + GlobalPos origin = new GlobalPos(world.rand.range(-SVars.originRadius, SVars.originRadius), 64, world.rand.range(-SVars.originRadius, SVars.originRadius), world); this.entity.setOrigin(origin); Position pos = this.server.getRandomSpawnPosition(origin); this.entity.teleport(pos); @@ -2756,7 +2756,7 @@ public class Player extends User implements Executor, IPlayer case MAGNET: if(this.isAdmin()) { - List list = this.entity.worldObj.getEntitiesWithinAABB(Entity.class, new BoundingBox(this.entity.getPosition().subtract(new BlockPos(128, 128, 128)), this.entity.getPosition().add(new BlockPos(128, 128, 128))), new Predicate() { + List list = this.entity.worldObj.getEntitiesWithinAABB(Entity.class, new BoundingBox(this.entity.getPosition().subtract(new LocalPos(128, 128, 128)), this.entity.getPosition().add(new LocalPos(128, 128, 128))), new Predicate() { public boolean test(Entity entity) { return entity.isEntityAlive() && (entity instanceof EntityItem || entity instanceof EntityXp); } @@ -2950,7 +2950,7 @@ public class Player extends User implements Executor, IPlayer return; WorldServer worldserver = this.getEntityWorld(); // this.serverController.getWorld(this.playerEntity.dimension); - BlockPos blockpos = packetIn.getPosition(); + LocalPos blockpos = packetIn.getPosition(); if (worldserver.isBlockLoaded(blockpos)) { diff --git a/server/src/main/java/server/village/VillageCollection.java b/server/src/main/java/server/village/VillageCollection.java index 498f1925..7c7930f0 100755 --- a/server/src/main/java/server/village/VillageCollection.java +++ b/server/src/main/java/server/village/VillageCollection.java @@ -8,7 +8,7 @@ import common.block.Material; import common.block.artificial.BlockDoor; import common.collect.Lists; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.village.Village; import common.village.VillageDoorInfo; @@ -16,7 +16,7 @@ import server.world.WorldServer; public class VillageCollection { - private final List villagerPositionsList = Lists.newArrayList(); + private final List villagerPositionsList = Lists.newArrayList(); private final List newDoors = Lists.newArrayList(); private final List villageList = Lists.newArrayList(); private int tickCounter; @@ -37,7 +37,7 @@ public class VillageCollection } } - public void addToVillagerPositionList(BlockPos pos) + public void addToVillagerPositionList(LocalPos pos) { if (this.villagerPositionsList.size() <= 64) { @@ -88,7 +88,7 @@ public class VillageCollection return this.villageList; } - public Village getNearestVillage(BlockPos doorBlock, int radius) + public Village getNearestVillage(LocalPos doorBlock, int radius) { Village village = null; double d0 = 3.4028234663852886E38D; @@ -140,7 +140,7 @@ public class VillageCollection this.newDoors.clear(); } - private void addDoorsAround(WorldServer world, BlockPos central) + private void addDoorsAround(WorldServer world, LocalPos central) { int i = 16; int j = 4; @@ -152,7 +152,7 @@ public class VillageCollection { for (int j1 = -k; j1 < k; ++j1) { - BlockPos blockpos = central.add(l, i1, j1); + LocalPos blockpos = central.add(l, i1, j1); if (this.isWoodDoor(world, blockpos)) { @@ -172,7 +172,7 @@ public class VillageCollection } } - private VillageDoorInfo checkDoorExistence(BlockPos doorBlock) + private VillageDoorInfo checkDoorExistence(LocalPos doorBlock) { for (VillageDoorInfo villagedoorinfo : this.newDoors) { @@ -195,7 +195,7 @@ public class VillageCollection return null; } - private void addToNewDoorsList(WorldServer world, BlockPos doorBlock) + private void addToNewDoorsList(WorldServer world, LocalPos doorBlock) { Facing enumfacing = BlockDoor.getFacing(world, doorBlock); Facing enumfacing1 = enumfacing.getOpposite(); @@ -208,7 +208,7 @@ public class VillageCollection } } - private int countBlocksCanSeeSky(WorldServer world, BlockPos centerPos, Facing direction, int limitation) + private int countBlocksCanSeeSky(WorldServer world, LocalPos centerPos, Facing direction, int limitation) { int i = 0; @@ -228,9 +228,9 @@ public class VillageCollection return i; } - private boolean positionInList(BlockPos pos) + private boolean positionInList(LocalPos pos) { - for (BlockPos blockpos : this.villagerPositionsList) + for (LocalPos blockpos : this.villagerPositionsList) { if (blockpos.equals(pos)) { @@ -241,7 +241,7 @@ public class VillageCollection return false; } - private boolean isWoodDoor(WorldServer world, BlockPos doorPos) + private boolean isWoodDoor(WorldServer world, LocalPos doorPos) { Block block = world.getState(doorPos).getBlock(); return block instanceof BlockDoor ? block.getMaterial() == Material.WOOD : false; diff --git a/server/src/main/java/server/world/ChunkServer.java b/server/src/main/java/server/world/ChunkServer.java index ab75a29d..7f92cd50 100644 --- a/server/src/main/java/server/world/ChunkServer.java +++ b/server/src/main/java/server/world/ChunkServer.java @@ -9,7 +9,7 @@ import common.init.Blocks; import common.log.Log; import common.rng.Random; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.BlockArray; import common.world.Chunk; import common.world.State; @@ -146,7 +146,7 @@ public class ChunkServer extends Chunk { } } - public Map getTiles() { + public Map getTiles() { return this.tiles; } diff --git a/server/src/main/java/server/world/Converter.java b/server/src/main/java/server/world/Converter.java index 90bc3bae..6b1859c3 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -78,10 +78,9 @@ import common.init.Blocks; import common.log.Log; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Facing.Axis; -import common.util.NibbleArray; import common.util.Color; import common.world.State; @@ -227,6 +226,22 @@ public abstract class Converter { } } + private static class NibbleArray { + private final byte[] data; + + public NibbleArray(byte[] data) { + if(data.length != 2048) + throw new IllegalArgumentException("NibbleArray sollte 2048 Bytes groß sein, nicht " + data.length); + this.data = data; + } + + public int get(int x, int y, int z) { + int idx = y << 8 | z << 4 | x; + int off = idx >> 1; + return (idx & 1) == 0 ? this.data[off] & 15 : this.data[off] >> 4 & 15; + } + } + private static interface BlockFunction { State getState(int id, int data); } @@ -1586,7 +1601,7 @@ public abstract class Converter { return start; } - public static BlockPos convert(File dir, String dest, Consumer finish) { + public static LocalPos convert(File dir, String dest, Consumer finish) { File ldat = new File(dir, "level.dat"); if(!ldat.exists()) ldat = new File(dir, "level.dat_old"); @@ -1643,7 +1658,7 @@ public abstract class Converter { if(ver == SaveVersion.RELEASE_1_9) Log.IO.warn("Konvertiere von neuerer Version, dies wird Blöcke entfernen ..."); chunkDir.mkdirs(); - BlockPos pos = new BlockPos(tag.getInt("SpawnX"), tag.getInt("SpawnY"), tag.getInt("SpawnZ")); + LocalPos pos = new LocalPos(tag.getInt("SpawnX"), tag.getInt("SpawnY"), tag.getInt("SpawnZ")); new Thread(new Runnable() { public void run() { int progress = 0; diff --git a/server/src/main/java/server/world/NextTickListEntry.java b/server/src/main/java/server/world/NextTickListEntry.java index 14ea8401..8a3b8df7 100755 --- a/server/src/main/java/server/world/NextTickListEntry.java +++ b/server/src/main/java/server/world/NextTickListEntry.java @@ -1,18 +1,18 @@ package server.world; import common.block.Block; -import common.util.BlockPos; +import common.util.LocalPos; public class NextTickListEntry implements Comparable { private static long nextId; private final Block block; - public final BlockPos position; + public final LocalPos position; private final long id; public long scheduledTime; public int priority; - public NextTickListEntry(BlockPos pos, Block block) { + public NextTickListEntry(LocalPos pos, Block block) { this.id = nextId++; this.position = pos; this.block = block; diff --git a/server/src/main/java/server/world/Region.java b/server/src/main/java/server/world/Region.java index 9829486c..d6634454 100755 --- a/server/src/main/java/server/world/Region.java +++ b/server/src/main/java/server/world/Region.java @@ -29,7 +29,7 @@ import common.init.EntityRegistry; import common.log.Log; import common.tags.TagObject; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Util; import common.world.BlockArray; import common.world.State; @@ -539,12 +539,12 @@ public class Region { if(tiles != null) { for(int n = 0; n < tiles.size(); ++n) { TagObject tile = tiles.get(n); - BlockPos pos = new BlockPos(tile.getByte("X"), tile.getShort("Y"), tile.getByte("Z")); + LocalPos pos = new LocalPos(tile.getByte("X"), tile.getShort("Y"), tile.getByte("Z")); if(pos.getX() < 0 || pos.getX() >= 16 || pos.getZ() < 0 || pos.getZ() >= 16 || pos.getY() < -World.MAX_SIZE_Y || pos.getY() >= World.MAX_SIZE_Y) { Log.TICK.warn("Ignoriere Block-Objekt mit ungültigen Koordinaten %d, %d, %d in Chunk %d, %d", pos.getX(), pos.getY(), pos.getZ(), chunk.xPos, chunk.zPos); continue; } - pos = new BlockPos(chunk.xPos << 4 | pos.getX(), pos.getY(), chunk.zPos << 4 | pos.getZ()); + pos = new LocalPos(chunk.xPos << 4 | pos.getX(), pos.getY(), chunk.zPos << 4 | pos.getZ()); TileEntity tileentity = TileEntity.createTile(world, chunk, pos, tile); if(tileentity != null) { @@ -563,7 +563,7 @@ public class Region { Block block = BlockRegistry.byName(tick.getString("B")); if(block != Blocks.air) { // FIX - world.scheduleBlockUpdate(new BlockPos(tick.getInt("X"), tick.getInt("Y"), tick.getInt("Z")), block, + world.scheduleBlockUpdate(new LocalPos(tick.getInt("X"), tick.getInt("Y"), tick.getInt("Z")), block, tick.getInt("T"), tick.getInt("P")); } else if(invalid++ < 10) { diff --git a/server/src/main/java/server/world/Spawner.java b/server/src/main/java/server/world/Spawner.java index e07e04b3..90ea0d07 100755 --- a/server/src/main/java/server/world/Spawner.java +++ b/server/src/main/java/server/world/Spawner.java @@ -10,7 +10,7 @@ import common.entity.types.EntityLiving; import common.init.Blocks; import common.rng.Random; import common.rng.WeightedList; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ChunkPos; import common.util.ExtMath; import common.world.World; @@ -21,7 +21,7 @@ public abstract class Spawner { private static final int MOB_COUNT_DIV = (int)Math.pow(17.0D, 2.0D); private static final Set CHUNKS = Sets.newHashSet(); - public static boolean canSpawnAt(boolean water, WorldServer world, BlockPos pos) { + public static boolean canSpawnAt(boolean water, WorldServer world, LocalPos pos) { if(!World.isValidXZ(pos)) { return false; } @@ -34,7 +34,7 @@ public abstract class Spawner { // return pos.getY() >= 118; // } else { - BlockPos down = pos.down(); + LocalPos down = pos.down(); if(!world.isBlockSolid(down)) { return false; } @@ -92,7 +92,7 @@ public abstract class Spawner { if(h == Integer.MIN_VALUE) continue; int y = world.rand.range(chunk.getBottomSegment(), h + 16); - BlockPos pos = new BlockPos(x, y, z); + LocalPos pos = new LocalPos(x, y, z); Block block = world.getState(pos).getBlock(); if(!block.isNormalCube()) { int group = 0; @@ -107,7 +107,7 @@ public abstract class Spawner { mx += world.rand.zrange(mobSpread) - world.rand.zrange(mobSpread); my += world.rand.zrange(1) - world.rand.zrange(1); mz += world.rand.zrange(mobSpread) - world.rand.zrange(mobSpread); - BlockPos mpos = new BlockPos(mx, my, mz); + LocalPos mpos = new LocalPos(mx, my, mz); float fx = (float)mx + 0.5F; float fz = (float)mz + 0.5F; if(!world.isAnyPlayerWithinRangeAt((double)fx, (double)my, (double)fz, playerDist)) { @@ -172,7 +172,7 @@ public abstract class Spawner { for(int n = 0; n < count; ++n) { boolean flag = false; for(int m = 0; !flag && m < 4; ++m) { - BlockPos pos = world.getHighestFreePos(new BlockPos(mx, 0, mz)); + LocalPos pos = world.getHighestFreePos(new LocalPos(mx, 0, mz)); if(canSpawnAt(EntityWaterNPC.class.isAssignableFrom(entry.type), world, pos)) { EntityLiving entity; try { diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index d2a7c23b..81601d81 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -57,12 +57,13 @@ import common.rng.Random; import common.rng.WeightedList; import common.tags.TagObject; import common.tileentity.TileEntity; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.BoundingBox; import common.util.ChunkPos; import common.util.ExtMath; import common.util.IntHashMap; import common.util.LongHashMap; +import common.util.MutablePos; import common.util.ParticleType; import common.util.PortalType; import common.util.Position; @@ -70,7 +71,6 @@ import common.util.Vec3; import common.vars.Vars; import common.village.Village; import common.world.BlockArray; -import common.world.Chunk; import common.world.AWorldServer; import common.world.State; import common.world.Weather; @@ -150,8 +150,8 @@ public final class WorldServer extends AWorldServer { private final List loaded = Lists.newArrayList(); private final Map toRemove = new ConcurrentHashMap(); private final Set pending = Collections.newSetFromMap(new ConcurrentHashMap()); - private final LongHashMap loaders = new LongHashMap(); - private final Set loaderList = Sets.newHashSet(); + private final LongHashMap loaders = new LongHashMap(); + private final Set loaderList = Sets.newHashSet(); private final List managed = Lists.newArrayList(); private final LongHashMap instances = new LongHashMap(); private final List toUpdate = Lists.newArrayList(); @@ -316,7 +316,7 @@ public final class WorldServer extends AWorldServer { List list = tag.getList("Loaders"); for(int z = 0; z < list.size(); z++) { TagObject pos = list.get(z); - this.addLoader(new BlockPos(pos.getInt("X"), pos.getInt("Y"), pos.getInt("Z"))); + this.addLoader(new LocalPos(pos.getInt("X"), pos.getInt("Y"), pos.getInt("Z"))); } this.loadersModified = false; } @@ -391,7 +391,7 @@ public final class WorldServer extends AWorldServer { return this.ores; } - public boolean addLoader(BlockPos pos) { + public boolean addLoader(LocalPos pos) { long chunk = LongHashMap.packInt(pos.getX() / 16, pos.getZ() / 16); if(this.loaders.containsItem(chunk)) return false; @@ -405,9 +405,9 @@ public final class WorldServer extends AWorldServer { // this.warpsModified = true; // } - public boolean removeLoader(BlockPos pos) { + public boolean removeLoader(LocalPos pos) { long chunk = LongHashMap.packInt(pos.getX() / 16, pos.getZ() / 16); - BlockPos loader = this.loaders.getValueByKey(chunk); + LocalPos loader = this.loaders.getValueByKey(chunk); if(!pos.equals(loader)) return false; this.loaders.remove(chunk); @@ -416,16 +416,16 @@ public final class WorldServer extends AWorldServer { return true; } - private WeightedList getSpawnTypes(BlockPos pos) { + private WeightedList getSpawnTypes(LocalPos pos) { return this.mobs; } - public RngSpawn getSpawnListEntryForTypeAt(BlockPos pos) { + public RngSpawn getSpawnListEntryForTypeAt(LocalPos pos) { WeightedList list = this.getSpawnTypes(pos); return list != null && !list.isEmpty() ? (RngSpawn)list.pick(this.rand) : null; } - public boolean canCreatureTypeSpawnHere(RngSpawn spawnListEntry, BlockPos pos) { + public boolean canCreatureTypeSpawnHere(RngSpawn spawnListEntry, LocalPos pos) { WeightedList list = this.getSpawnTypes(pos); return list != null && !list.isEmpty() ? list.contains(spawnListEntry) : false; } @@ -467,7 +467,7 @@ public final class WorldServer extends AWorldServer { if(tics > 0 && this.rand.zrange(tics) == 0 && this.isThundering()) { this.updateLCG = this.updateLCG * 3 + 1013904223; int i1 = this.updateLCG >> 2; - BlockPos blockpos = this.adjustPosToNearbyEntity(new BlockPos(cx + (i1 & 15), 0, cz + (i1 >> 8 & 15))); + LocalPos blockpos = this.adjustPosToNearbyEntity(new LocalPos(cx + (i1 & 15), 0, cz + (i1 >> 8 & 15))); if(this.canStrikeAt(blockpos)) { this.strikeLightning((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0x737380, 120, true, null); @@ -481,8 +481,8 @@ public final class WorldServer extends AWorldServer { if(this.rand.zrange(16) == 0) { this.updateLCG = this.updateLCG * 3 + 1013904223; int k2 = this.updateLCG >> 2; - BlockPos blockpos2 = this.getPrecipitationHeight(new BlockPos(cx + (k2 & 15), 0, cz + (k2 >> 8 & 15))); - BlockPos blockpos1 = blockpos2.down(); + LocalPos blockpos2 = this.getPrecipitationHeight(new LocalPos(cx + (k2 & 15), 0, cz + (k2 >> 8 & 15))); + LocalPos blockpos1 = blockpos2.down(); if(this.snow && this.isRaining() && this.canSnowAt(blockpos2, true, SVars.snowStack)) { State layer = SVars.snowStack ? this.getState(blockpos2) : null; @@ -522,7 +522,7 @@ public final class WorldServer extends AWorldServer { if(block.isTicked()) { ++dtics; - BlockPos bpos = new BlockPos(x + cx, y + section.getY(), z + cz); + LocalPos bpos = new LocalPos(x + cx, y + section.getY(), z + cz); block.tick(this, bpos, state, this.rand); if(block.getRadiation() > 0.0f && this.rand.chance(tics / 3)) this.applyRadiation(bpos, state, block); @@ -537,7 +537,7 @@ public final class WorldServer extends AWorldServer { } } - private void applyRadiation(BlockPos pos, State state, Block block) { + private void applyRadiation(LocalPos pos, State state, Block block) { float rad = block.getRadiation() * 8.0f * 0.25f; float r = ExtMath.clampf(rad * 2.0f, 0.0f, 25.0f); BoundingBox box = block.getCollisionBox(this, pos, state); @@ -550,9 +550,9 @@ public final class WorldServer extends AWorldServer { } } - private BlockPos adjustPosToNearbyEntity(BlockPos pos) { - BlockPos blockpos = this.getPrecipitationHeight(pos); - BoundingBox axisalignedbb = (new BoundingBox(blockpos, new BlockPos(blockpos.getX(), World.MAX_SIZE_Y, blockpos.getZ()))).expand(3.0D, + private LocalPos adjustPosToNearbyEntity(LocalPos pos) { + LocalPos blockpos = this.getPrecipitationHeight(pos); + BoundingBox axisalignedbb = (new BoundingBox(blockpos, new LocalPos(blockpos.getX(), World.MAX_SIZE_Y, blockpos.getZ()))).expand(3.0D, 3.0D, 3.0D); List list = this.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb, new Predicate() { public boolean test(EntityLiving p_apply_1_) { @@ -562,16 +562,16 @@ public final class WorldServer extends AWorldServer { return !list.isEmpty() ? ((EntityLiving)list.get(this.rand.zrange(list.size()))).getPosition() : blockpos; } - public boolean isBlockTickPending(BlockPos pos, Block blockType) { + public boolean isBlockTickPending(LocalPos pos, Block blockType) { NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockType); return this.ticksNow.contains(nextticklistentry); } - public void scheduleUpdate(BlockPos pos, Block blockIn, int delay) { + public void scheduleUpdate(LocalPos pos, Block blockIn, int delay) { this.updateBlockTick(pos, blockIn, delay, 0); } - public void updateBlockTick(BlockPos pos, Block blockIn, int delay, int priority) { + public void updateBlockTick(LocalPos pos, Block blockIn, int delay, int priority) { NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockIn); int i = 0; @@ -607,7 +607,7 @@ public final class WorldServer extends AWorldServer { } } - public void scheduleBlockUpdate(BlockPos pos, Block blockIn, int delay, int priority) { + public void scheduleBlockUpdate(LocalPos pos, Block blockIn, int delay, int priority) { NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockIn); nextticklistentry.setPriority(priority); @@ -709,7 +709,7 @@ public final class WorldServer extends AWorldServer { iter = this.ticksNow.iterator(); while(iter.hasNext()) { NextTickListEntry tick = iter.next(); - BlockPos pos = tick.position; + LocalPos pos = tick.position; if(pos.getX() >= x1 && pos.getX() < x2 && pos.getZ() >= z1 && pos.getZ() < z2) { if(list == null) list = Lists.newArrayList(); @@ -725,7 +725,7 @@ public final class WorldServer extends AWorldServer { for(int i = 0; i < this.tiles.size(); ++i) { TileEntity tileentity = (TileEntity)this.tiles.get(i); - BlockPos blockpos = tileentity.getPos(); + LocalPos blockpos = tileentity.getPos(); if(blockpos.getX() >= minX && blockpos.getY() >= minY && blockpos.getZ() >= minZ && blockpos.getX() < maxX && blockpos.getY() < maxY && blockpos.getZ() < maxZ) { @@ -838,7 +838,7 @@ public final class WorldServer extends AWorldServer { this.loadersModified = false; TagObject loaders = new TagObject(); List list = Lists.newArrayList(); - for(BlockPos pos : this.loaderList) { + for(LocalPos pos : this.loaderList) { TagObject loader = new TagObject(); loader.setInt("X", pos.getX()); loader.setInt("Y", pos.getY()); @@ -907,12 +907,12 @@ public final class WorldServer extends AWorldServer { this.sendNear(entity.posX, entity.posY, entity.posZ, 512.0D, new SPacketSpawnGlobalEntity(entity, 1, entity.color)); if(fire && Vars.fire) { - BlockPos pos = new BlockPos(entity); + LocalPos pos = new LocalPos(entity); if(this.isAreaLoaded(pos, 10)) { if(this.getState(pos).getBlock() == Blocks.air && Blocks.fire.canPlace(this, pos)) this.setState(pos, Blocks.fire.getState()); for(int n = 0; n < 4; n++) { - BlockPos extra = pos.add(this.rand.range(-1, 1), this.rand.range(-1, 1), this.rand.range(-1, 1)); + LocalPos extra = pos.add(this.rand.range(-1, 1), this.rand.range(-1, 1), this.rand.range(-1, 1)); if(this.getState(extra).getBlock() == Blocks.air && Blocks.fire.canPlace(this, extra)) this.setState(extra, Blocks.fire.getState()); } @@ -924,7 +924,7 @@ public final class WorldServer extends AWorldServer { this.sendToAllTrackingAndSelf(entityIn, new SPacketEntityStatus(entityIn, state)); } - private boolean destroyBlock(BlockPos pos, float power, EntityLiving source) { + private boolean destroyBlock(LocalPos pos, float power, EntityLiving source) { State state = this.getState(pos); Block block = state.getBlock(); if(block != Blocks.air && (block.getMaterial().isLiquid() || power - (block.getResistance() / 5.0F + 0.3F) * 0.3F > 0.0F)) { @@ -985,7 +985,7 @@ public final class WorldServer extends AWorldServer { } public void explode(EntityLiving source, Entity exploder, double posX, double posY, double posZ, float radius, boolean fire, boolean destroy, boolean altSound) { - Set set = Sets.newHashSet(); + Set set = Sets.newHashSet(); int d = ((int)radius) + 1; double falloff = radius * 0.125d; falloff = falloff > 4.0d ? 4.0d : falloff; @@ -998,14 +998,14 @@ public final class WorldServer extends AWorldServer { double dist = (double)ExtMath.sqrtd(((double)x) * ((double)x) + ((double)y) * ((double)y) + ((double)z) * ((double)z)); if(dist < radius - falloff || (dist < radius && this.rand.doublev() + ((dist - (radius - falloff)) / falloff) < 1.0d)) { - BlockPos pos = new BlockPos(posX + x, posY + y, posZ + z); + LocalPos pos = new LocalPos(posX + x, posY + y, posZ + z); if(this.destroyBlock(pos, radius, source)) set.add(pos); } } } } - List blocks = Lists.newArrayList(set); + List blocks = Lists.newArrayList(set); set.clear(); Set velocity = this.damageEntities(exploder, source, posX, posY, posZ, radius); @@ -1014,7 +1014,7 @@ public final class WorldServer extends AWorldServer { if (fire) { - for (BlockPos pos : blocks) + for (LocalPos pos : blocks) { if(this.getState(pos).getBlock() == Blocks.air && this.getState(pos.down()).getBlock().isFullBlock() && this.rand.zrange(3) == 0) this.setState(pos, Blocks.fire.getState()); @@ -1048,7 +1048,7 @@ public final class WorldServer extends AWorldServer { double dist = (double)ExtMath.sqrtd(((double)x) * ((double)x) + ((double)y) * ((double)y) + ((double)z) * ((double)z)); if(dist > minDist && (dist < radius - falloff || (dist < radius && this.rand.doublev() + ((dist - (radius - falloff)) / falloff) < 1.0d))) { - BlockPos pos = new BlockPos(posX + x, posY + y, posZ + z); + LocalPos pos = new LocalPos(posX + x, posY + y, posZ + z); if(this.destroyBlock(pos, (float)radius, null) && this.rand.chance(1000)) { this.sendSound(SoundEvent.EXPLODE, posX + x, posY + y, posZ + z, 4.0F); this.spawnParticles(ParticleType.EXPLOSION_HUGE, posX + x, posY + y, posZ + z); @@ -1187,7 +1187,7 @@ public final class WorldServer extends AWorldServer { for(int i = 0; i < this.players.size(); ++i) { EntityNPC entityplayermp = this.players.get(i); - BlockPos blockpos = entityplayermp.getPosition(); + LocalPos blockpos = entityplayermp.getPosition(); double d0 = blockpos.distanceSq(xCoord, yCoord, zCoord); if(d0 <= 256.0D || particleType.isUnlimited() && d0 <= 65536.0D) { @@ -1205,7 +1205,7 @@ public final class WorldServer extends AWorldServer { return chunk == null ? this.loadChunk(x, z) : chunk; } - public ChunkServer getChunk(BlockPos pos) { + public ChunkServer getChunk(LocalPos pos) { return this.getChunk(pos.getX() >> 4, pos.getZ() >> 4); } @@ -1220,7 +1220,7 @@ public final class WorldServer extends AWorldServer { } public void loadForcedChunks() { - for(BlockPos pos : this.loaderList) { + for(LocalPos pos : this.loaderList) { this.loadChunk(pos.getX() / 16, pos.getZ() / 16); } } @@ -1400,7 +1400,7 @@ public final class WorldServer extends AWorldServer { BlockFalling.fallInstantly = true; int bx = x * 16; int bz = z * 16; - BlockPos pos = new BlockPos(bx, 0, bz); + LocalPos pos = new LocalPos(bx, 0, bz); this.grng.setSeed(this.seed); long sx = this.grng.longv() / 2L * 2L + 1L; long sz = this.grng.longv() / 2L * 2L + 1L; @@ -1446,8 +1446,8 @@ public final class WorldServer extends AWorldServer { pos = pos.add(8, 0, 8); for(int fx = 0; fx < 16; ++fx) { for(int fz = 0; fz < 16; ++fz) { - BlockPos snow = this.getPrecipitationHeight(pos.add(fx, 0, fz)); - BlockPos ice = snow.down(); + LocalPos snow = this.getPrecipitationHeight(pos.add(fx, 0, fz)); + LocalPos ice = snow.down(); if(this.canBlockFreeze(ice, false)) { this.setState(ice, Blocks.ice.getState(), 2); } @@ -1499,7 +1499,7 @@ public final class WorldServer extends AWorldServer { // this.reloadChunks(); //TODO: why was this here? for(EntityNPC player : this.players) { player.attackEntityFrom(DamageSource.causeExterminatusDamage(null), 5000); - Packet packet = new SPacketEffect(1025, new BlockPos(player.posX, (double)this.getSeaLevel() + 4.0, player.posZ), 0); + Packet packet = new SPacketEffect(1025, new LocalPos(player.posX, (double)this.getSeaLevel() + 4.0, player.posZ), 0); player.connection.sendPacket(packet); } return true; @@ -1514,7 +1514,7 @@ public final class WorldServer extends AWorldServer { this.resetWeather(); if(!this.loaderList.isEmpty()) this.loadersModified = true; - for(BlockPos pos : this.loaderList) { + for(LocalPos pos : this.loaderList) { this.loaders.remove(LongHashMap.packInt(pos.getX() / 16, pos.getZ() / 16)); } this.loaderList.clear(); @@ -1640,17 +1640,17 @@ public final class WorldServer extends AWorldServer { return String.format("%d C, %d O, %d t, %d T, %d F", chunks, entities, tiles, ticked, forced); } - public void forceBlockUpdateTick(Block blockType, BlockPos pos, Random random) { + public void forceBlockUpdateTick(Block blockType, LocalPos pos, Random random) { this.updatesForced = 128; blockType.tick(this, pos, this.getState(pos), random); this.updatesForced = 0; } - public Village getNearestVillage(BlockPos doorBlock, int radius) { + public Village getNearestVillage(LocalPos doorBlock, int radius) { return this.villageStorage == null ? null : this.villageStorage.getNearestVillage(doorBlock, radius); } - public void addToVillagerPositionList(BlockPos blockpos) { + public void addToVillagerPositionList(LocalPos blockpos) { if(this.villageStorage != null) this.villageStorage.addToVillagerPositionList(blockpos); } @@ -1664,7 +1664,7 @@ public final class WorldServer extends AWorldServer { this.sendNear(x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, new SPacketSoundEffect(sound, x, y, z, volume)); } - public void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data) + public void playEffect(EntityNPC player, int sfxType, LocalPos blockPosIn, int data) { this.sendNearExcept(player, (double)blockPosIn.getX(), (double)blockPosIn.getY(), (double)blockPosIn.getZ(), 64.0D, new SPacketEffect(sfxType, blockPosIn, data)); } @@ -1718,7 +1718,7 @@ public final class WorldServer extends AWorldServer { return inst; } - public void markBlockForUpdate(BlockPos pos) { + public void markBlockForUpdate(LocalPos pos) { int x = pos.getX() >> 4; int z = pos.getZ() >> 4; PlayerInstance inst = this.getPlayerInstance(x, z, false); @@ -2007,7 +2007,7 @@ public final class WorldServer extends AWorldServer { } } - public boolean setState(BlockPos pos, State newState, int flags) { + public boolean setState(LocalPos pos, State newState, int flags) { if(!isValid(pos)) return false; ChunkServer chunk = this.getChunk(pos); @@ -2023,7 +2023,7 @@ public final class WorldServer extends AWorldServer { return true; } - public final boolean setBlock(BlockPos pos, ClipboardBlock block) { + public final boolean setBlock(LocalPos pos, ClipboardBlock block) { // int x = position.getBlockX(); // int y = position.getBlockY(); // int z = position.getBlockZ(); @@ -2063,7 +2063,7 @@ public final class WorldServer extends AWorldServer { return successful; } - public final ClipboardBlock getBlock(BlockPos pos) { + public final ClipboardBlock getBlock(LocalPos pos) { // BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); State state = this.getState(pos); TileEntity tile = this.getTileEntity(pos); @@ -2083,7 +2083,7 @@ public final class WorldServer extends AWorldServer { return entities; } - public boolean canStrikeAt(BlockPos strikePosition) { + public boolean canStrikeAt(LocalPos strikePosition) { if(this.getPrecipitationHeight(strikePosition).getY() > strikePosition.getY()) { return false; } @@ -2137,7 +2137,7 @@ public final class WorldServer extends AWorldServer { return t; } - public boolean canPlaceFireAt(BlockPos pos) { + public boolean canPlaceFireAt(LocalPos pos) { if(!this.canBurnAt(pos)) { return false; } @@ -2152,7 +2152,7 @@ public final class WorldServer extends AWorldServer { return false; } - public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) { + public boolean canBlockFreeze(LocalPos pos, boolean noWaterAdj) { if(!this.canFreezeAt(pos)) { return false; } @@ -2188,7 +2188,7 @@ public final class WorldServer extends AWorldServer { int l = ExtMath.floord(bb.maxY); int i1 = ExtMath.floord(bb.minZ); int j1 = ExtMath.floord(bb.maxZ); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for(int k1 = i; k1 <= j; ++k1) { for(int l1 = k; l1 <= l; ++l1) { @@ -2205,13 +2205,13 @@ public final class WorldServer extends AWorldServer { return false; } - public BlockPos getHighestFreePos(BlockPos pos) { + public LocalPos getHighestFreePos(LocalPos pos) { ChunkServer chunk = this.getChunk(pos); int h = chunk.getTopSegment(); if(h == Integer.MIN_VALUE) - return new BlockPos(pos.getX(), 0, pos.getZ()); - BlockPos free = new BlockPos(pos.getX(), h + 16, pos.getZ()); - BlockPos down; + return new LocalPos(pos.getX(), 0, pos.getZ()); + LocalPos free = new LocalPos(pos.getX(), h + 16, pos.getZ()); + LocalPos down; h = chunk.getBottomSegment(); if(free.getY() - h > 512) h = free.getY() - 512; @@ -2246,10 +2246,10 @@ public final class WorldServer extends AWorldServer { this.onEntityRemoved(entityIn); } - public Block getGroundAboveSeaLevel(BlockPos pos) { - BlockPos blockpos; + public Block getGroundAboveSeaLevel(LocalPos pos) { + LocalPos blockpos; - for(blockpos = new BlockPos(pos.getX(), this.getSeaLevel(), pos.getZ()); !this.isAirBlock(blockpos.up()); blockpos = blockpos.up()) { + for(blockpos = new LocalPos(pos.getX(), this.getSeaLevel(), pos.getZ()); !this.isAirBlock(blockpos.up()); blockpos = blockpos.up()) { ; } @@ -2302,7 +2302,7 @@ public final class WorldServer extends AWorldServer { } } - protected float getTemperature(BlockPos pos) { + protected float getTemperature(LocalPos pos) { float temperature = this.biomeGen == null ? 0.0f : this.biomeGen.getBiomeAt(pos).temperature; return pos.getY() > 64 ? temperature - (this.getTempNoise(pos.getX(), pos.getZ()) + (float)pos.getY() - 64.0F) / 15.0f : temperature; } @@ -2319,22 +2319,22 @@ public final class WorldServer extends AWorldServer { return this.biomeGen == null ? 50.0f : this.biomeGen.getBiomeAt(x, z).humidity; } - public LeavesType getLeavesGen(BlockPos pos) { + public LeavesType getLeavesGen(LocalPos pos) { return this.canFreezeAt(pos) ? LeavesType.SNOWY : (!this.dimension.hasSeasons() ? this.gen.getLeavesType() : LeavesType.values()[(int)((this.orbit % this.dimension.getOrbitalPeriod()) * 4L / this.dimension.getOrbitalPeriod())]); } - public BlockPos getHeight(BlockPos pos) { + public LocalPos getHeight(LocalPos pos) { int y; if(pos.getX() >= -MAX_SIZE && pos.getZ() >= -MAX_SIZE && pos.getX() < MAX_SIZE && pos.getZ() < MAX_SIZE) y = this.isLoaded(pos.getX() >> 4, pos.getZ() >> 4, true) ? this.getChunk(pos.getX() >> 4, pos.getZ() >> 4).getHeight(pos.getX() & 15, pos.getZ() & 15) : 0; else y = this.getSeaLevel() + 1; - return new BlockPos(pos.getX(), y, pos.getZ()); + return new LocalPos(pos.getX(), y, pos.getZ()); } - public boolean makePortal(BlockPos pos, int maxHeight, PortalType type) // TODO: Portals + public boolean makePortal(LocalPos pos, int maxHeight, PortalType type) // TODO: Portals { return false; // int i = 16; @@ -2546,7 +2546,7 @@ public final class WorldServer extends AWorldServer { return (List)this.server.getPlayers(); } - public void placeInDimension(Entity entity, AWorldServer oldWorld, AWorldServer world, BlockPos pos, PortalType portal) { + public void placeInDimension(Entity entity, AWorldServer oldWorld, AWorldServer world, LocalPos pos, PortalType portal) { this.server.placeInDimension(entity, (WorldServer)oldWorld, (WorldServer)world, pos, portal); } @@ -2558,7 +2558,7 @@ public final class WorldServer extends AWorldServer { return TeleportRegistry.getPortalDest(this.dimension, portal); } - public void markChunkDirty(BlockPos pos) { + public void markChunkDirty(LocalPos pos) { if(this.isBlockLoaded(pos)) this.getChunk(pos).setModified(true); } @@ -2575,7 +2575,7 @@ public final class WorldServer extends AWorldServer { } } - public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) { + public void notifyNeighborsOfStateChange(LocalPos pos, Block blockType) { this.notifyBlockOfStateChange(pos.west(), blockType); this.notifyBlockOfStateChange(pos.east(), blockType); this.notifyBlockOfStateChange(pos.down(), blockType); @@ -2584,7 +2584,7 @@ public final class WorldServer extends AWorldServer { this.notifyBlockOfStateChange(pos.south(), blockType); } - private void notifyBlockOfStateChange(BlockPos pos, final Block blockIn) { + private void notifyBlockOfStateChange(LocalPos pos, final Block blockIn) { State iblockstate = this.getState(pos); iblockstate.getBlock().onUpdate(this, pos, iblockstate, blockIn); } @@ -2598,7 +2598,7 @@ public final class WorldServer extends AWorldServer { return new SPacketMultiBlockChange(pos, changes); } - public boolean generateBigMushroom(BlockPos pos, State state, Random rand) + public boolean generateBigMushroom(LocalPos pos, State state, Random rand) { this.setBlockToAir(pos); FeatureGenerator worldgenerator = null; @@ -2623,18 +2623,18 @@ public final class WorldServer extends AWorldServer { } } - private boolean isTypeAt(BlockPos pos, WoodType type) + private boolean isTypeAt(LocalPos pos, WoodType type) { State iblockstate = this.getState(pos); return iblockstate.getBlock() instanceof BlockSapling && ((BlockSapling)iblockstate.getBlock()).getWoodType() == type; } - private boolean isSameSaplingTypeIn(BlockPos pos, int xOff, int yOff, WoodType type) + private boolean isSameSaplingTypeIn(LocalPos pos, int xOff, int yOff, WoodType type) { return this.isTypeAt(pos.add(xOff, 0, yOff), type) && this.isTypeAt(pos.add(xOff + 1, 0, yOff), type) && this.isTypeAt(pos.add(xOff, 0, yOff + 1), type) && this.isTypeAt(pos.add(xOff + 1, 0, yOff + 1), type); } - public void generateTree(BlockPos pos, State state, Random rand) + public void generateTree(LocalPos pos, State state, Random rand) { WoodType type = state.getBlock() instanceof BlockSapling ? ((BlockSapling)state.getBlock()).getWoodType() : WoodType.OAK; State log = type == WoodType.CHERRY ? Blocks.cherry_log.getState() : // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY) : @@ -2767,13 +2767,13 @@ public final class WorldServer extends AWorldServer { } } - public void growGrass(BlockPos pos, State state, Random rand) + public void growGrass(LocalPos pos, State state, Random rand) { - BlockPos blockpos = pos.up(); + LocalPos blockpos = pos.up(); for (int i = 0; i < 128; ++i) { - BlockPos blockpos1 = blockpos; + LocalPos blockpos1 = blockpos; int j = 0; while (true) @@ -2927,7 +2927,7 @@ public final class WorldServer extends AWorldServer { int x = (int)(this.changes[0] >> 36 & 15L) + this.position.x * 16; int y = (int)(this.changes[0] & 4294967295L); int z = (int)(this.changes[0] >> 32 & 15L) + this.position.z * 16; - BlockPos pos = new BlockPos(x, y, z); + LocalPos pos = new LocalPos(x, y, z); this.sendToAllPlayersWatchingChunk(new SPacketBlockChange(WorldServer.this, pos)); if(WorldServer.this.getState(pos).getBlock() instanceof ITileEntityProvider) { @@ -2974,7 +2974,7 @@ public final class WorldServer extends AWorldServer { int x = (int)(this.changes[n] >> 36 & 15L) + this.position.x * 16; int y = (int)(this.changes[n] & 4294967295L); int z = (int)(this.changes[n] >> 32 & 15L) + this.position.z * 16; - BlockPos pos = new BlockPos(x, y, z); + LocalPos pos = new LocalPos(x, y, z); if(WorldServer.this.getState(pos).getBlock() instanceof ITileEntityProvider) { this.sendTileToAllPlayersWatchingChunk(WorldServer.this.getTileEntity(pos)); diff --git a/server/src/main/java/server/worldgen/FeatureGenerator.java b/server/src/main/java/server/worldgen/FeatureGenerator.java index 52bd234e..e9c8f952 100755 --- a/server/src/main/java/server/worldgen/FeatureGenerator.java +++ b/server/src/main/java/server/worldgen/FeatureGenerator.java @@ -1,7 +1,7 @@ package server.worldgen; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.world.WorldServer; @@ -16,9 +16,9 @@ public abstract class FeatureGenerator { this.notify = notify; } - public abstract boolean generate(WorldServer world, Random rand, BlockPos pos); + public abstract boolean generate(WorldServer world, Random rand, LocalPos pos); - protected final void setBlockNotify(WorldServer world, BlockPos pos, State state) { + protected final void setBlockNotify(WorldServer world, LocalPos pos, State state) { world.setState(pos, state, this.notify ? 3 : 2); } } diff --git a/server/src/main/java/server/worldgen/caves/MapGenCaves.java b/server/src/main/java/server/worldgen/caves/MapGenCaves.java index e4180ab4..722fa407 100755 --- a/server/src/main/java/server/worldgen/caves/MapGenCaves.java +++ b/server/src/main/java/server/worldgen/caves/MapGenCaves.java @@ -5,8 +5,8 @@ import common.block.natural.BlockColoredClay; import common.dimension.Dimension; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; import common.util.ExtMath; +import common.util.MutablePos; import common.world.State; import server.dimension.GeneratorData; import server.world.WorldServer; @@ -173,7 +173,7 @@ public class MapGenCaves extends MapGenBase if (!flag3) { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int j3 = k2; j3 < k; ++j3) { diff --git a/server/src/main/java/server/worldgen/caves/MapGenRavine.java b/server/src/main/java/server/worldgen/caves/MapGenRavine.java index c595268a..8ef8d535 100755 --- a/server/src/main/java/server/worldgen/caves/MapGenRavine.java +++ b/server/src/main/java/server/worldgen/caves/MapGenRavine.java @@ -4,8 +4,8 @@ import common.block.Block; import common.dimension.Dimension; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; import common.util.ExtMath; +import common.util.MutablePos; import common.world.State; import server.dimension.GeneratorData; import server.world.WorldServer; @@ -165,7 +165,7 @@ public class MapGenRavine extends MapGenBase if (!flag2) { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int j3 = k2; j3 < k; ++j3) { diff --git a/server/src/main/java/server/worldgen/component/FeatureDungeons.java b/server/src/main/java/server/worldgen/component/FeatureDungeons.java index 6bdd9e40..e40eb6b9 100755 --- a/server/src/main/java/server/worldgen/component/FeatureDungeons.java +++ b/server/src/main/java/server/worldgen/component/FeatureDungeons.java @@ -14,7 +14,7 @@ import common.rng.Random; import common.rng.WeightedList; import common.tileentity.TileEntity; import common.tileentity.TileEntityChest; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.vars.Vars; import common.world.World; @@ -35,7 +35,7 @@ public class FeatureDungeons } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) { + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { boolean flag = false; for(int z = 0; z < this.chance; z++) { flag |= this.generateDungeon(worldIn, rand, position.add(rand.chOffset(), rand.zrange(this.height), rand.chOffset())); @@ -43,7 +43,7 @@ public class FeatureDungeons return flag; } - private boolean generateDungeon(WorldServer worldIn, Random rand, BlockPos position) + private boolean generateDungeon(WorldServer worldIn, Random rand, LocalPos position) { int i = 3; int j = rand.zrange(2) + 2; @@ -62,7 +62,7 @@ public class FeatureDungeons { for (int i3 = l1; i3 <= i2; ++i3) { - BlockPos blockpos = position.add(k2, l2, i3); + LocalPos blockpos = position.add(k2, l2, i3); Material material = worldIn.getState(blockpos).getBlock().getMaterial(); boolean flag = material.isSolid(); @@ -92,7 +92,7 @@ public class FeatureDungeons { for (int k4 = l1; k4 <= i2; ++k4) { - BlockPos blockpos1 = position.add(k3, i4, k4); + LocalPos blockpos1 = position.add(k3, i4, k4); if (k3 != k && i4 != -1 && k4 != l1 && k3 != l && i4 != 4 && k4 != i2) { @@ -127,7 +127,7 @@ public class FeatureDungeons int l4 = position.getX() + rand.zrange(j * 2 + 1) - j; int i5 = position.getY(); int j5 = position.getZ() + rand.zrange(k1 * 2 + 1) - k1; - BlockPos blockpos2 = new BlockPos(l4, i5, j5); + LocalPos blockpos2 = new LocalPos(l4, i5, j5); if (worldIn.isAirBlock(blockpos2)) { diff --git a/server/src/main/java/server/worldgen/component/FeatureLakes.java b/server/src/main/java/server/worldgen/component/FeatureLakes.java index 83532d64..4ff86941 100755 --- a/server/src/main/java/server/worldgen/component/FeatureLakes.java +++ b/server/src/main/java/server/worldgen/component/FeatureLakes.java @@ -4,7 +4,7 @@ import common.block.Block; import common.block.Material; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.world.WorldServer; @@ -45,7 +45,7 @@ public class FeatureLakes // this(block, block == Blocks.lava ? Blocks.stone.getDefaultState() : null, Blocks.dirt, Blocks.grass.getDefaultState()); // } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) { + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { if(this.ratiod) { if(this.chance >= 1 && rand.chance(this.chance)) { int y = rand.range(this.minHeight, this.maxHeight); // rand.zrange(rand.zrange(248) + 8); @@ -61,7 +61,7 @@ public class FeatureLakes return false; } - private boolean generateLake(WorldServer worldIn, Random rand, BlockPos position) + private boolean generateLake(WorldServer worldIn, Random rand, LocalPos position) { for (position = position.add(-8, 0, -8); position.getY() > 5 && worldIn.isAirBlock(position); position = position.down()) { @@ -164,7 +164,7 @@ public class FeatureLakes { if (aboolean[(i2 * 16 + j3) * 8 + j4]) { - BlockPos blockpos = position.add(i2, j4 - 1, j3); + LocalPos blockpos = position.add(i2, j4 - 1, j3); if (worldIn.getState(blockpos).getBlock() == replace && worldIn.getState(blockpos.up()).getBlock() == Blocks.air) { diff --git a/server/src/main/java/server/worldgen/component/FeatureLiquids.java b/server/src/main/java/server/worldgen/component/FeatureLiquids.java index ab796c4d..26ceb3ed 100755 --- a/server/src/main/java/server/worldgen/component/FeatureLiquids.java +++ b/server/src/main/java/server/worldgen/component/FeatureLiquids.java @@ -3,7 +3,7 @@ package server.worldgen.component; import common.block.Block; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.world.WorldServer; @@ -40,7 +40,7 @@ public class FeatureLiquids } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) { + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { Block replace = worldIn.dimension.getFiller().getBlock(); boolean flag = false; for(int z = 0; z < this.chance; z++) { @@ -56,7 +56,7 @@ public class FeatureLiquids return flag; } - private boolean generateLiquid(WorldServer worldIn, Random rand, BlockPos position, Block replace) + private boolean generateLiquid(WorldServer worldIn, Random rand, LocalPos position, Block replace) { if (worldIn.getState(position.up()).getBlock() != replace) { diff --git a/server/src/main/java/server/worldgen/component/FeatureOres.java b/server/src/main/java/server/worldgen/component/FeatureOres.java index 2b8607a7..63d79f54 100755 --- a/server/src/main/java/server/worldgen/component/FeatureOres.java +++ b/server/src/main/java/server/worldgen/component/FeatureOres.java @@ -2,7 +2,7 @@ package server.worldgen.component; import common.block.Block; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.world.State; import common.world.World; @@ -81,14 +81,14 @@ public class FeatureOres // this.replace = replace; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) { + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { Block replace = /* this.replace != null ? this.replace : */ worldIn.dimension.getFiller().getBlock(); int tries = this.spawnTries == 0 ? (rand.zrange(this.moreTries) == 0 ? 1 : 0) : (this.spawnTries + (this.moreTries == 0 ? 0 : rand.zrange(this.moreTries + 1))); // tries = tries == 0 ? (this.numberOfBlocks == 1 ? (rand.nextInt(10) == 0 ? 1 : 0) : rand.nextInt(2)) : tries; for(int j = 0; j < tries; j++) { - BlockPos blockpos; + LocalPos blockpos; if(this.distributed) { blockpos = position.add(rand.zrange(16), rand.zrange(this.maxHeight) + rand.zrange(this.maxHeight) + this.minHeight - this.maxHeight, rand.zrange(16)); } @@ -107,7 +107,7 @@ public class FeatureOres return true; } - private void generateVein(WorldServer worldIn, Random rand, BlockPos position, Block replace) + private void generateVein(WorldServer worldIn, Random rand, LocalPos position, Block replace) { float f = rand.floatv() * (float)Math.PI; double d0 = (double)(/* (float)(position.getX() + 8) */ 8.0f + ExtMath.sin(f) * (float)this.numberOfBlocks / 8.0F); @@ -151,7 +151,7 @@ public class FeatureOres if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) { - BlockPos blockpos = position.add(l1, i2, j2); // new BlockPos(l1, i2, j2); + LocalPos blockpos = position.add(l1, i2, j2); // new BlockPos(l1, i2, j2); if (worldIn.getState(blockpos).getBlock() == replace) { diff --git a/server/src/main/java/server/worldgen/feature/WorldGenAbandonedChest.java b/server/src/main/java/server/worldgen/feature/WorldGenAbandonedChest.java index e16e4a72..0e6cfc1d 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenAbandonedChest.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenAbandonedChest.java @@ -9,7 +9,7 @@ import common.rng.Random; import common.rng.WeightedList; import common.tileentity.TileEntity; import common.tileentity.TileEntityChest; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -32,7 +32,7 @@ public class WorldGenAbandonedChest extends FeatureGenerator this(LootConstants.ABANDONED_ITEMS, 10); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { Block block; while (((block = worldIn.getState(position).getBlock()) == Blocks.air || block.getMaterial() == Material.LEAVES) && position.getY() > 1) @@ -48,7 +48,7 @@ public class WorldGenAbandonedChest extends FeatureGenerator position = position.up(); for (int i = 0; i < 4; ++i) { - BlockPos blockpos = position.add(rand.zrange(4) - rand.zrange(4), rand.zrange(3) - rand.zrange(3), rand.zrange(4) - rand.zrange(4)); + LocalPos blockpos = position.add(rand.zrange(4) - rand.zrange(4), rand.zrange(3) - rand.zrange(3), rand.zrange(4) - rand.zrange(4)); if (worldIn.isAirBlock(blockpos) && worldIn.isBlockSolid(blockpos.down())) { worldIn.setState(blockpos, Blocks.wood_chest.getState().withProperty(BlockChest.FACING, Facing.randHorizontal(rand)), 2); diff --git a/server/src/main/java/server/worldgen/feature/WorldGenAsteroid.java b/server/src/main/java/server/worldgen/feature/WorldGenAsteroid.java index 4444a4bd..a671bf0f 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenAsteroid.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenAsteroid.java @@ -1,7 +1,7 @@ package server.worldgen.feature; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -13,7 +13,7 @@ public class WorldGenAsteroid extends FeatureGenerator { this.blocks = blocks; } - public boolean generate(WorldServer world, Random rand, BlockPos pos) { + public boolean generate(WorldServer world, Random rand, LocalPos pos) { for(pos = pos.add(-8, 0, -8); pos.getY() > 9 && !world.isAirBlock(pos); pos = pos.down()) { ; } diff --git a/server/src/main/java/server/worldgen/feature/WorldGenBlockBlob.java b/server/src/main/java/server/worldgen/feature/WorldGenBlockBlob.java index 57957760..23504bce 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenBlockBlob.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenBlockBlob.java @@ -3,7 +3,7 @@ package server.worldgen.feature; import common.block.Block; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -19,7 +19,7 @@ public class WorldGenBlockBlob extends FeatureGenerator this.field_150544_b = p_i45450_2_; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { while (true) { @@ -54,7 +54,7 @@ public class WorldGenBlockBlob extends FeatureGenerator int l = i1 + rand.zrange(2); float f = (float)(j + k + l) * 0.333F + 0.5F; - for (BlockPos blockpos : BlockPos.getAllInBox(position.add(-j, -k, -l), position.add(j, k, l))) + for (LocalPos blockpos : LocalPos.area(position.add(-j, -k, -l), position.add(j, k, l))) { if (blockpos.distanceSq(position) <= (double)(f * f)) { diff --git a/server/src/main/java/server/worldgen/feature/WorldGenClay.java b/server/src/main/java/server/worldgen/feature/WorldGenClay.java index e1b125ac..5c753a84 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenClay.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenClay.java @@ -3,7 +3,7 @@ package server.worldgen.feature; import common.block.Block; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -19,7 +19,7 @@ public class WorldGenClay extends FeatureGenerator this.numberOfBlocks = blocks; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { if (!worldIn.getState(position).getBlock().getMaterial().isColdLiquid()) { @@ -41,7 +41,7 @@ public class WorldGenClay extends FeatureGenerator { for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1) { - BlockPos blockpos = new BlockPos(k, k1, l); + LocalPos blockpos = new LocalPos(k, k1, l); Block block = worldIn.getState(blockpos).getBlock(); if (block == Blocks.dirt || block == Blocks.clay) diff --git a/server/src/main/java/server/worldgen/feature/WorldGenClayExt.java b/server/src/main/java/server/worldgen/feature/WorldGenClayExt.java index 1f5c616e..c6284d8b 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenClayExt.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenClayExt.java @@ -3,7 +3,7 @@ package server.worldgen.feature; import common.block.Block; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import server.world.WorldServer; @@ -12,7 +12,7 @@ public class WorldGenClayExt extends WorldGenClay { super(blocks); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) { + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { if(!worldIn.getState(position).getBlock().getMaterial().isColdLiquid()) { return false; } @@ -39,7 +39,7 @@ public class WorldGenClayExt extends WorldGenClay { if(d12 * d12 + d13 * d13 + d14 * d14 >= 1.0D) { continue; } - BlockPos blockpos = new BlockPos(i1, j1, k1); + LocalPos blockpos = new LocalPos(i1, j1, k1); Block block = worldIn.getState(blockpos).getBlock(); if(block == Blocks.sand) { diff --git a/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java b/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java index 9f8b9e41..83800684 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenDesertWells.java @@ -3,7 +3,7 @@ package server.worldgen.feature; import common.block.artificial.BlockSlab; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import server.world.WorldServer; @@ -15,7 +15,7 @@ public class WorldGenDesertWells extends FeatureGenerator private final State field_175912_c = Blocks.sandstone.getState(); private final State field_175910_d = Blocks.flowing_water.getState(); - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { while (worldIn.isAirBlock(position) && position.getY() > 2) { diff --git a/server/src/main/java/server/worldgen/feature/WorldGenFire.java b/server/src/main/java/server/worldgen/feature/WorldGenFire.java index 2eb87281..8f864910 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenFire.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenFire.java @@ -2,17 +2,17 @@ package server.worldgen.feature; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; public class WorldGenFire extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { for (int i = 0; i < 64; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); if (worldIn.isAirBlock(blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.hellrock) { diff --git a/server/src/main/java/server/worldgen/feature/WorldGenGlowStone.java b/server/src/main/java/server/worldgen/feature/WorldGenGlowStone.java index 951ece1c..58e53ab4 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenGlowStone.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenGlowStone.java @@ -2,14 +2,14 @@ package server.worldgen.feature; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import server.world.WorldServer; import server.worldgen.FeatureGenerator; public class WorldGenGlowStone extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { if (!worldIn.isAirBlock(position)) { @@ -25,7 +25,7 @@ public class WorldGenGlowStone extends FeatureGenerator for (int i = 0; i < 1500; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), -rand.zrange(12), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), -rand.zrange(12), rand.zrange(8) - rand.zrange(8)); if (worldIn.getState(blockpos).getBlock() == Blocks.air) { diff --git a/server/src/main/java/server/worldgen/feature/WorldGenHellLava.java b/server/src/main/java/server/worldgen/feature/WorldGenHellLava.java index 4d536bf7..025df974 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenHellLava.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenHellLava.java @@ -3,7 +3,7 @@ package server.worldgen.feature; import common.block.Block; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -18,7 +18,7 @@ public class WorldGenHellLava extends FeatureGenerator this.field_94524_b = p_i45453_2_; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { if (worldIn.getState(position.up()).getBlock() != Blocks.hellrock) { diff --git a/server/src/main/java/server/worldgen/feature/WorldGenIcePath.java b/server/src/main/java/server/worldgen/feature/WorldGenIcePath.java index 0f84e5cc..8b8c822b 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenIcePath.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenIcePath.java @@ -3,7 +3,7 @@ package server.worldgen.feature; import common.block.Block; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -17,7 +17,7 @@ public class WorldGenIcePath extends FeatureGenerator this.basePathWidth = p_i45454_1_; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { while (worldIn.isAirBlock(position) && position.getY() > 2) { @@ -44,7 +44,7 @@ public class WorldGenIcePath extends FeatureGenerator { for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1) { - BlockPos blockpos = new BlockPos(k, k1, l); + LocalPos blockpos = new LocalPos(k, k1, l); Block block = worldIn.getState(blockpos).getBlock(); if (block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) diff --git a/server/src/main/java/server/worldgen/feature/WorldGenIceSpike.java b/server/src/main/java/server/worldgen/feature/WorldGenIceSpike.java index e103a2cb..3c33372a 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenIceSpike.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenIceSpike.java @@ -3,14 +3,14 @@ package server.worldgen.feature; import common.block.Block; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import server.world.WorldServer; import server.worldgen.FeatureGenerator; public class WorldGenIceSpike extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { while (worldIn.isAirBlock(position) && position.getY() > 2) { @@ -83,7 +83,7 @@ public class WorldGenIceSpike extends FeatureGenerator { for (int i2 = -k1; i2 <= k1; ++i2) { - BlockPos blockpos = position.add(l1, -1, i2); + LocalPos blockpos = position.add(l1, -1, i2); int j2 = 50; if (Math.abs(l1) == 1 && Math.abs(i2) == 1) diff --git a/server/src/main/java/server/worldgen/feature/WorldGenSand.java b/server/src/main/java/server/worldgen/feature/WorldGenSand.java index edc5cadb..7fb84fa1 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenSand.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenSand.java @@ -3,7 +3,7 @@ package server.worldgen.feature; import common.block.Block; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -20,7 +20,7 @@ public class WorldGenSand extends FeatureGenerator this.radius = p_i45462_2_; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { if (!worldIn.getState(position).getBlock().getMaterial().isColdLiquid()) { @@ -42,7 +42,7 @@ public class WorldGenSand extends FeatureGenerator { for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1) { - BlockPos blockpos = new BlockPos(k, k1, l); + LocalPos blockpos = new LocalPos(k, k1, l); Block block = worldIn.getState(blockpos).getBlock(); if (block == Blocks.dirt || block == Blocks.grass) diff --git a/server/src/main/java/server/worldgen/feature/WorldGenSpikes.java b/server/src/main/java/server/worldgen/feature/WorldGenSpikes.java index 9885fe81..03739a70 100755 --- a/server/src/main/java/server/worldgen/feature/WorldGenSpikes.java +++ b/server/src/main/java/server/worldgen/feature/WorldGenSpikes.java @@ -4,7 +4,8 @@ import common.block.Block; import common.entity.Entity; import common.entity.item.EntityCrystal; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; +import common.util.MutablePos; import common.world.State; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -28,13 +29,13 @@ public class WorldGenSpikes extends FeatureGenerator this.crystals = crystals; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { if (worldIn.isAirBlock(position) && worldIn.getState(position.down()).getBlock() == this.base) { int i = rand.zrange(this.maxHeight - 6) + 6; int j = rand.range(this.minRadius, this.maxRadius); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int k = position.getX() - j; k <= position.getX() + j; ++k) { @@ -61,7 +62,7 @@ public class WorldGenSpikes extends FeatureGenerator if (k2 * k2 + k1 * k1 <= j * j + 1) { - worldIn.setState(new BlockPos(i2, l1, j2), this.block, 2); + worldIn.setState(new LocalPos(i2, l1, j2), this.block, 2); } } } diff --git a/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java b/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java index db6590c2..67a3942c 100755 --- a/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java +++ b/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java @@ -2,7 +2,7 @@ package server.worldgen.foliage; import common.block.foliage.BlockDoublePlant; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; public class FeatureDoublePlant @@ -14,13 +14,13 @@ public class FeatureDoublePlant this.type = type; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { boolean flag = false; for (int i = 0; i < 64; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 254) && this.type.canPlace(worldIn, blockpos)) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenBigMushroom.java b/server/src/main/java/server/worldgen/foliage/WorldGenBigMushroom.java index eeaa2d26..b6ac5281 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenBigMushroom.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenBigMushroom.java @@ -6,7 +6,8 @@ import common.block.foliage.BlockHugeMushroom; import common.block.foliage.BlockHugeMushroom.EnumType; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; +import common.util.MutablePos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -26,7 +27,7 @@ public class WorldGenBigMushroom extends FeatureGenerator super(false); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { // if (this.mushroomType == null) // { @@ -47,7 +48,7 @@ public class WorldGenBigMushroom extends FeatureGenerator k = 0; } - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) { @@ -189,7 +190,7 @@ public class WorldGenBigMushroom extends FeatureGenerator if (position.getY() >= position.getY() + i - 1 || dir != BlockHugeMushroom.EnumType.ALL_INSIDE) { - BlockPos blockpos = new BlockPos(l1, l2, i2); + LocalPos blockpos = new LocalPos(l1, l2, i2); if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenCactus.java b/server/src/main/java/server/worldgen/foliage/WorldGenCactus.java index 74354e82..ea82863b 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenCactus.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenCactus.java @@ -2,17 +2,17 @@ package server.worldgen.foliage; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; public class WorldGenCactus extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { for (int i = 0; i < 10; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); if (worldIn.isAirBlock(blockpos)) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenDeadBush.java b/server/src/main/java/server/worldgen/foliage/WorldGenDeadBush.java index ae5c9f74..350a7c1c 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenDeadBush.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenDeadBush.java @@ -4,13 +4,13 @@ import common.block.Block; import common.block.Material; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; public class WorldGenDeadBush extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { Block block; @@ -21,7 +21,7 @@ public class WorldGenDeadBush extends FeatureGenerator for (int i = 0; i < 4; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); if (worldIn.isAirBlock(blockpos) && Blocks.deadbush.canBlockStay(worldIn, blockpos, Blocks.deadbush.getState())) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenFlowers.java b/server/src/main/java/server/worldgen/foliage/WorldGenFlowers.java index 398318d0..36669c67 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenFlowers.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenFlowers.java @@ -2,7 +2,7 @@ package server.worldgen.foliage; import common.block.foliage.BlockFlower; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -23,11 +23,11 @@ public class WorldGenFlowers extends FeatureGenerator this.state = block.getState(); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { for (int i = 0; i < 64; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 511) && this.flower.canBlockStay(worldIn, blockpos, this.state)) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenMelon.java b/server/src/main/java/server/worldgen/foliage/WorldGenMelon.java index 264c3e99..4168633c 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenMelon.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenMelon.java @@ -2,17 +2,17 @@ package server.worldgen.foliage; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; public class WorldGenMelon extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { for (int i = 0; i < 64; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); if (Blocks.melon_block.canPlace(worldIn, blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenMushroom.java b/server/src/main/java/server/worldgen/foliage/WorldGenMushroom.java index 7ea6decb..f387f52b 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenMushroom.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenMushroom.java @@ -2,7 +2,7 @@ package server.worldgen.foliage; import common.block.foliage.BlockBush; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -15,11 +15,11 @@ public class WorldGenMushroom extends FeatureGenerator this.field_175908_a = p_i45633_1_; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { for (int i = 0; i < 64; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 511) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getState())) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenPumpkin.java b/server/src/main/java/server/worldgen/foliage/WorldGenPumpkin.java index 97cd8757..ec807b01 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenPumpkin.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenPumpkin.java @@ -2,17 +2,17 @@ package server.worldgen.foliage; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; public class WorldGenPumpkin extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { for (int i = 0; i < 64; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); if (worldIn.isAirBlock(blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlace(worldIn, blockpos)) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenReed.java b/server/src/main/java/server/worldgen/foliage/WorldGenReed.java index 45be4d91..a63f1a1d 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenReed.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenReed.java @@ -3,21 +3,21 @@ package server.worldgen.foliage; import common.block.Material; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; public class WorldGenReed extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { for (int i = 0; i < 20; ++i) { - BlockPos blockpos = position.add(rand.zrange(4) - rand.zrange(4), 0, rand.zrange(4) - rand.zrange(4)); + LocalPos blockpos = position.add(rand.zrange(4) - rand.zrange(4), 0, rand.zrange(4) - rand.zrange(4)); if (worldIn.isAirBlock(blockpos)) { - BlockPos blockpos1 = blockpos.down(); + LocalPos blockpos1 = blockpos.down(); if (worldIn.getState(blockpos1.west()).getBlock().getMaterial() == Material.WATER || worldIn.getState(blockpos1.east()).getBlock().getMaterial() == Material.WATER || worldIn.getState(blockpos1.north()).getBlock().getMaterial() == Material.WATER || worldIn.getState(blockpos1.south()).getBlock().getMaterial() == Material.WATER) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java b/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java index ea7790ca..b821e07a 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java @@ -6,7 +6,7 @@ import common.block.foliage.BlockLeaves; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.world.WorldServer; import server.worldgen.tree.WorldGenBaseTree; @@ -23,7 +23,7 @@ public class WorldGenShrub extends WorldGenBaseTree this.leavesMetadata = leaves; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { Block block; @@ -54,7 +54,7 @@ public class WorldGenShrub extends WorldGenBaseTree if (Math.abs(i1) != k || Math.abs(k1) != k || rand.zrange(2) != 0) { - BlockPos blockpos = new BlockPos(l, i, j1); + LocalPos blockpos = new LocalPos(l, i, j1); if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java b/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java index e0257bd3..fc7bbb4b 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenTallGrass.java @@ -5,7 +5,7 @@ import common.block.Material; import common.block.foliage.BlockTallGrass; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -21,7 +21,7 @@ public class WorldGenTallGrass extends FeatureGenerator this.tallGrassState = block.getState(); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { Block block; @@ -32,7 +32,7 @@ public class WorldGenTallGrass extends FeatureGenerator for (int i = 0; i < 128; ++i) { - BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); + LocalPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); if (worldIn.isAirBlock(blockpos) && this.tallGrass.canBlockStay(worldIn, blockpos, this.tallGrassState)) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenVines.java b/server/src/main/java/server/worldgen/foliage/WorldGenVines.java index fe6bde54..68576525 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenVines.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenVines.java @@ -3,7 +3,7 @@ package server.worldgen.foliage; import common.block.foliage.BlockVine; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.world.State; import server.world.WorldServer; @@ -11,7 +11,7 @@ import server.worldgen.FeatureGenerator; public class WorldGenVines extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { for (; position.getY() < 128; position = position.up()) { diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java b/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java index a9490230..999bdbf0 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java @@ -3,14 +3,14 @@ package server.worldgen.foliage; import common.block.foliage.BlockLilyPad; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import server.world.WorldServer; import server.worldgen.FeatureGenerator; public class WorldGenWaterlily extends FeatureGenerator { - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { for (int i = 0; i < 10; ++i) { @@ -18,9 +18,9 @@ public class WorldGenWaterlily extends FeatureGenerator int k = position.getY() + rand.zrange(4) - rand.zrange(4); int l = position.getZ() + rand.zrange(8) - rand.zrange(8); - if (worldIn.isAirBlock(new BlockPos(j, k, l)) && Blocks.waterlily.canPlace(worldIn, new BlockPos(j, k, l))) + if (worldIn.isAirBlock(new LocalPos(j, k, l)) && Blocks.waterlily.canPlace(worldIn, new LocalPos(j, k, l))) { - worldIn.setState(new BlockPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)), 2); + worldIn.setState(new LocalPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)), 2); } } diff --git a/server/src/main/java/server/worldgen/layer/BiomeGenerator.java b/server/src/main/java/server/worldgen/layer/BiomeGenerator.java index 153065f6..4d186893 100755 --- a/server/src/main/java/server/worldgen/layer/BiomeGenerator.java +++ b/server/src/main/java/server/worldgen/layer/BiomeGenerator.java @@ -3,7 +3,7 @@ package server.worldgen.layer; import java.util.List; import common.collect.Lists; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.LongHashMap; import server.worldgen.Scaling; @@ -172,7 +172,7 @@ public class BiomeGenerator { return id < 0 || id >= this.biomes.length || this.biomes[id] == null ? this.defBiome : this.biomes[id]; } - public Biome getBiomeAt(BlockPos pos) { + public Biome getBiomeAt(LocalPos pos) { int x = pos.getX(); int z = pos.getZ(); Biome biome = this.getBiomeCacheBlock(x, z).getBiomeGenAt(x, z); diff --git a/server/src/main/java/server/worldgen/populator/Populator.java b/server/src/main/java/server/worldgen/populator/Populator.java index 495fe1d8..99ddbf22 100644 --- a/server/src/main/java/server/worldgen/populator/Populator.java +++ b/server/src/main/java/server/worldgen/populator/Populator.java @@ -1,9 +1,9 @@ package server.worldgen.populator; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; public interface Populator { - void decorate(WorldServer world, Random rand, BlockPos pos); + void decorate(WorldServer world, Random rand, LocalPos pos); } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorAlphaLike.java b/server/src/main/java/server/worldgen/populator/PopulatorAlphaLike.java index 2b17a0cb..b7c6f0cf 100644 --- a/server/src/main/java/server/worldgen/populator/PopulatorAlphaLike.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorAlphaLike.java @@ -1,7 +1,7 @@ package server.worldgen.populator; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.rng.PerlinGen; import server.world.WorldServer; @@ -13,7 +13,7 @@ public class PopulatorAlphaLike extends PopulatorBasic { this.clayExtPerChunk = 10; } - public void decorate(WorldServer world, Random rand, BlockPos pos) { + public void decorate(WorldServer world, Random rand, LocalPos pos) { this.treesPerChunk = (int)((TREE_NOISE.generate((double)pos.getX() * 0.5D, (double)pos.getZ() * 0.5D) / 8D + rand.doublev() * 4D + 4D) / 3D) + 5; super.decorate(world, rand, pos); } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorAsteroids.java b/server/src/main/java/server/worldgen/populator/PopulatorAsteroids.java index a3885866..8d9b7e17 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorAsteroids.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorAsteroids.java @@ -2,7 +2,7 @@ package server.worldgen.populator; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; import server.worldgen.feature.WorldGenAsteroid; @@ -14,7 +14,7 @@ public class PopulatorAsteroids extends PopulatorBasic protected FeatureGenerator asteroidGen2 = new WorldGenAsteroid(Blocks.dirt.getState(), Blocks.coarse_dirt.getState()); - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { if(rand.chance(5)) { int x = rand.chOffset(); diff --git a/server/src/main/java/server/worldgen/populator/PopulatorBasic.java b/server/src/main/java/server/worldgen/populator/PopulatorBasic.java index 1dce7fd5..0c5bdbbb 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorBasic.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorBasic.java @@ -3,7 +3,7 @@ package server.worldgen.populator; import common.block.foliage.BlockFlower; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; import server.worldgen.feature.WorldGenClay; @@ -64,12 +64,12 @@ public abstract class PopulatorBasic implements Populator { return new WorldGenTallGrass(Blocks.tallgrass); } - protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) + protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos) { return rand.rarity(3) ? BlockFlower.EnumFlowerType.DANDELION : BlockFlower.EnumFlowerType.ROSE; } - public void decorate(WorldServer world, Random rand, BlockPos pos) + public void decorate(WorldServer world, Random rand, LocalPos pos) { for (int i = 0; i < this.sandPerChunk2; ++i) { @@ -112,7 +112,7 @@ public abstract class PopulatorBasic implements Populator { int l = rand.chOffset(); WorldGenTree treeGen = this.genBigTreeChance(rand); treeGen.prepare(); - BlockPos blockpos = world.getHeight(pos.add(k6, 0, l)); + LocalPos blockpos = world.getHeight(pos.add(k6, 0, l)); if (treeGen.generate(world, rand, blockpos)) { @@ -136,7 +136,7 @@ public abstract class PopulatorBasic implements Populator { if (j14 > 0) { int k17 = rand.zrange(j14); - BlockPos blockpos1 = pos.add(i7, k17, l10); + LocalPos blockpos1 = pos.add(i7, k17, l10); BlockFlower.EnumFlowerType blockflower$enumflowertype = this.pickRandomFlower(rand, blockpos1); this.yellowFlowerGen.setGeneratedBlock(BlockFlower.getByType(blockflower$enumflowertype)); @@ -179,8 +179,8 @@ public abstract class PopulatorBasic implements Populator { if (i15 > 0) { int j18 = rand.zrange(i15); - BlockPos blockpos4; - BlockPos blockpos7; + LocalPos blockpos4; + LocalPos blockpos7; for (blockpos4 = pos.add(l7, j18, k11); blockpos4.getY() > 0; blockpos4 = blockpos7) { @@ -202,7 +202,7 @@ public abstract class PopulatorBasic implements Populator { { int i8 = rand.chOffset(); int l11 = rand.chOffset(); - BlockPos blockpos2 = world.getHeight(pos.add(i8, 0, l11)); + LocalPos blockpos2 = world.getHeight(pos.add(i8, 0, l11)); this.mushroomBrownGen.generate(world, rand, blockpos2); } @@ -215,7 +215,7 @@ public abstract class PopulatorBasic implements Populator { if (j15 > 0) { int k18 = rand.zrange(j15); - BlockPos blockpos5 = pos.add(j8, k18, i12); + LocalPos blockpos5 = pos.add(j8, k18, i12); this.mushroomRedGen.generate(world, rand, blockpos5); } } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorBlackened.java b/server/src/main/java/server/worldgen/populator/PopulatorBlackened.java index 65e1bec0..53807534 100644 --- a/server/src/main/java/server/worldgen/populator/PopulatorBlackened.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorBlackened.java @@ -4,7 +4,7 @@ import common.block.foliage.BlockFlower; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.worldgen.tree.WorldGenBaseTree; import server.worldgen.tree.WorldGenTree; @@ -15,7 +15,7 @@ public class PopulatorBlackened extends PopulatorBasic { this.treesPerChunk = 3; } - protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) { + protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos) { return BlockFlower.EnumFlowerType.BLACK_LOTUS; } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorChaos.java b/server/src/main/java/server/worldgen/populator/PopulatorChaos.java index 749e0c75..606f700f 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorChaos.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorChaos.java @@ -2,7 +2,7 @@ package server.worldgen.populator; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; import server.worldgen.foliage.WorldGenMushroom; @@ -11,7 +11,7 @@ public class PopulatorChaos extends PopulatorBasic { protected FeatureGenerator mushroomBlueGen = new WorldGenMushroom(Blocks.blue_mushroom); - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { super.decorate(worldIn, rand, pos); @@ -19,7 +19,7 @@ public class PopulatorChaos extends PopulatorBasic { int i8 = rand.chOffset(); int l11 = rand.chOffset(); - BlockPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11)); + LocalPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11)); this.mushroomBlueGen.generate(worldIn, rand, blockpos2); } } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorDesert.java b/server/src/main/java/server/worldgen/populator/PopulatorDesert.java index 86f91108..df41e547 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorDesert.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorDesert.java @@ -1,7 +1,7 @@ package server.worldgen.populator; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.feature.WorldGenDesertWells; @@ -15,7 +15,7 @@ public class PopulatorDesert extends PopulatorBasic this.cactiPerChunk = 10; } - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { super.decorate(worldIn, rand, pos); @@ -23,7 +23,7 @@ public class PopulatorDesert extends PopulatorBasic { int i = rand.chOffset(); int j = rand.chOffset(); - BlockPos blockpos = worldIn.getHeight(pos.add(i, 0, j)).up(); + LocalPos blockpos = worldIn.getHeight(pos.add(i, 0, j)).up(); (new WorldGenDesertWells()).generate(worldIn, rand, blockpos); } } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorForest.java b/server/src/main/java/server/worldgen/populator/PopulatorForest.java index 07e66986..3d7c0609 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorForest.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorForest.java @@ -5,7 +5,7 @@ import common.block.foliage.BlockFlower; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import server.rng.PerlinGen; import server.world.WorldServer; @@ -76,7 +76,7 @@ public class PopulatorForest extends PopulatorBasic (this.subType == 4 || rand.chance(2) ? (rand.chance(this.subType == 4 ? 32 : 5) ? this.mapleBig : this.maple) : normalBirch))); } - protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) + protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos) { if(this.subType == 0) { double d0 = GRASS_NOISE.generate((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D); @@ -124,7 +124,7 @@ public class PopulatorForest extends PopulatorBasic } } - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { if(this.subType == 0) { double d0 = GRASS_NOISE.generate((double)(pos.getX() + 8) / 200.0D, (double)(pos.getZ() + 8) / 200.0D); @@ -192,7 +192,7 @@ public class PopulatorForest extends PopulatorBasic { int k = i * 4 + rand.range(9, 11); int l = j * 4 + rand.range(9, 11); - BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l)); + LocalPos blockpos = worldIn.getHeight(pos.add(k, 0, l)); if (rand.chance(20)) { @@ -238,7 +238,7 @@ public class PopulatorForest extends PopulatorBasic int k2 = rand.chOffset(); int i1 = rand.zrange(worldIn.getHeight(pos.add(j2, 0, k2)).getY() + 32); - if (DOUBLE_PLANT_GEN.generate(worldIn, rand, new BlockPos(pos.getX() + j2, i1, pos.getZ() + k2))) + if (DOUBLE_PLANT_GEN.generate(worldIn, rand, new LocalPos(pos.getX() + j2, i1, pos.getZ() + k2))) { break; } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorHell.java b/server/src/main/java/server/worldgen/populator/PopulatorHell.java index ba485265..5356d0f0 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorHell.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorHell.java @@ -2,7 +2,7 @@ package server.worldgen.populator; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.component.FeatureOres; import server.worldgen.feature.WorldGenFire; @@ -33,7 +33,7 @@ public class PopulatorHell extends PopulatorBasic this.redMushroomGen = new WorldGenMushroom(Blocks.red_mushroom); } - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { for (int i = 0; i < 8; ++i) { diff --git a/server/src/main/java/server/worldgen/populator/PopulatorHills.java b/server/src/main/java/server/worldgen/populator/PopulatorHills.java index debc39d6..1bcdf4d3 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorHills.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorHills.java @@ -2,7 +2,7 @@ package server.worldgen.populator; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.component.FeatureOres; import server.worldgen.tree.WorldGenTaiga2; @@ -24,7 +24,7 @@ public class PopulatorHills extends PopulatorBasic return (WorldGenTree)(rand.rarity(3) ? this.field_150634_aD : super.genBigTreeChance(rand)); } - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { super.decorate(worldIn, rand, pos); this.theEmeraldGenerator.generate(worldIn, rand, pos); diff --git a/server/src/main/java/server/worldgen/populator/PopulatorSavanna.java b/server/src/main/java/server/worldgen/populator/PopulatorSavanna.java index 62f64eb8..de85a7ac 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorSavanna.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorSavanna.java @@ -2,7 +2,7 @@ package server.worldgen.populator; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.tree.WorldGenSavanna; import server.worldgen.tree.WorldGenTree; @@ -23,7 +23,7 @@ public class PopulatorSavanna extends PopulatorBasic return (WorldGenTree)(rand.rarity(5) ? field_150627_aC : this.worldGeneratorTrees); } - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { DOUBLE_PLANT_GEN.setPlantType(Blocks.large_tallgrass); diff --git a/server/src/main/java/server/worldgen/populator/PopulatorSpikes.java b/server/src/main/java/server/worldgen/populator/PopulatorSpikes.java index adbed344..99df241d 100644 --- a/server/src/main/java/server/worldgen/populator/PopulatorSpikes.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorSpikes.java @@ -1,7 +1,7 @@ package server.worldgen.populator; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.feature.WorldGenIcePath; import server.worldgen.feature.WorldGenIceSpike; @@ -13,7 +13,7 @@ public class PopulatorSpikes extends PopulatorBasic private final WorldGenIceSpike spikeGen = new WorldGenIceSpike(); private final WorldGenIcePath pathGen = new WorldGenIcePath(4); - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { for (int i = 0; i < 3; ++i) { diff --git a/server/src/main/java/server/worldgen/populator/PopulatorSwamp.java b/server/src/main/java/server/worldgen/populator/PopulatorSwamp.java index eed4b9cf..66e2b626 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorSwamp.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorSwamp.java @@ -3,7 +3,7 @@ package server.worldgen.populator; import common.block.foliage.BlockFlower; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.worldgen.FeatureGenerator; import server.worldgen.foliage.WorldGenTallGrass; import server.worldgen.tree.WorldGenSwamp; @@ -32,7 +32,7 @@ public class PopulatorSwamp extends PopulatorBasic return this.worldGeneratorSwamp; } - protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) + protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos) { return BlockFlower.EnumFlowerType.BLUE_ORCHID; } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorTaiga.java b/server/src/main/java/server/worldgen/populator/PopulatorTaiga.java index a31de061..0bb0bcc2 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorTaiga.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorTaiga.java @@ -2,7 +2,7 @@ package server.worldgen.populator; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; import server.worldgen.feature.WorldGenBlockBlob; @@ -49,7 +49,7 @@ public class PopulatorTaiga extends PopulatorBasic return rand.rarity(5) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass); } - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { if (this.subType == 1 || this.subType == 2) { @@ -59,7 +59,7 @@ public class PopulatorTaiga extends PopulatorBasic { int k = rand.chOffset(); int l = rand.chOffset(); - BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l)); + LocalPos blockpos = worldIn.getHeight(pos.add(k, 0, l)); field_150643_aG.generate(worldIn, rand, blockpos); } } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorTerranian.java b/server/src/main/java/server/worldgen/populator/PopulatorTerranian.java index 0db6ee26..fcabac10 100644 --- a/server/src/main/java/server/worldgen/populator/PopulatorTerranian.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorTerranian.java @@ -1,7 +1,7 @@ package server.worldgen.populator; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; public class PopulatorTerranian implements Populator { @@ -20,7 +20,7 @@ public class PopulatorTerranian implements Populator { private final Populator tallTreeTaiga = new PopulatorTaiga(2); private final Populator tallBirchForest = new PopulatorForest(1); - public void decorate(WorldServer world, Random rand, BlockPos pos) { + public void decorate(WorldServer world, Random rand, LocalPos pos) { float absTemp = world.getGenTemperature(pos.getX(), pos.getZ()); float humidity = world.getGenHumidity(pos.getX(), pos.getZ()); diff --git a/server/src/main/java/server/worldgen/populator/PopulatorTian.java b/server/src/main/java/server/worldgen/populator/PopulatorTian.java index 81434244..33bf18f5 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorTian.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorTian.java @@ -4,7 +4,7 @@ import common.block.foliage.BlockFlower; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; import server.worldgen.feature.WorldGenSpikes; @@ -32,7 +32,7 @@ public class PopulatorTian extends PopulatorBasic this.treesPerChunk = 1; } - protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) + protected BlockFlower.EnumFlowerType pickRandomFlower(Random rand, LocalPos pos) { return BlockFlower.EnumFlowerType.BLACK_LOTUS; } @@ -42,7 +42,7 @@ public class PopulatorTian extends PopulatorBasic return rand.pick(rand.chance(this.treeGen2, this.treeGen1, 4), rand.chance(this.treeGen3, this.treeGen4, 15)); } - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { super.decorate(worldIn, rand, pos); @@ -52,7 +52,7 @@ public class PopulatorTian extends PopulatorBasic { int i8 = rand.chOffset(); int l11 = rand.chOffset(); - BlockPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11)); + LocalPos blockpos2 = worldIn.getHeight(pos.add(i8, 0, l11)); this.mushroomBlueGen.generate(worldIn, rand, blockpos2); } } diff --git a/server/src/main/java/server/worldgen/populator/PopulatorTropical.java b/server/src/main/java/server/worldgen/populator/PopulatorTropical.java index 390e6081..81f68a23 100755 --- a/server/src/main/java/server/worldgen/populator/PopulatorTropical.java +++ b/server/src/main/java/server/worldgen/populator/PopulatorTropical.java @@ -3,7 +3,7 @@ package server.worldgen.populator; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -38,7 +38,7 @@ public class PopulatorTropical extends PopulatorBasic return rand.chance(4) ? new WorldGenTallGrass(Blocks.fern) : new WorldGenTallGrass(Blocks.tallgrass); } - public void decorate(WorldServer worldIn, Random rand, BlockPos pos) + public void decorate(WorldServer worldIn, Random rand, LocalPos pos) { super.decorate(worldIn, rand, pos); int i = rand.chOffset(); diff --git a/server/src/main/java/server/worldgen/replacer/ReplacerAltSimple.java b/server/src/main/java/server/worldgen/replacer/ReplacerAltSimple.java index 2f879ce5..331b5af2 100644 --- a/server/src/main/java/server/worldgen/replacer/ReplacerAltSimple.java +++ b/server/src/main/java/server/worldgen/replacer/ReplacerAltSimple.java @@ -3,7 +3,7 @@ package server.worldgen.replacer; import common.dimension.Dimension; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.MutablePos; import common.world.State; import server.dimension.GeneratorData; import server.world.WorldServer; @@ -75,7 +75,7 @@ public class ReplacerAltSimple extends ReplacerBiome int rng = (int)(noise / 3.0D + 3.0D + rand.doublev() * 0.25D); int bx = x & 15; int bz = z & 15; - BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); + MutablePos pos = new MutablePos(); for (int by = primer.height - 1; by >= 0; by--) { diff --git a/server/src/main/java/server/worldgen/structure/MapGenScatteredFeature.java b/server/src/main/java/server/worldgen/structure/MapGenScatteredFeature.java index caaa6252..3e2b4d97 100755 --- a/server/src/main/java/server/worldgen/structure/MapGenScatteredFeature.java +++ b/server/src/main/java/server/worldgen/structure/MapGenScatteredFeature.java @@ -1,7 +1,7 @@ package server.worldgen.structure; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; public class MapGenScatteredFeature extends MapGenStructure @@ -50,7 +50,7 @@ public class MapGenScatteredFeature extends MapGenStructure return new MapGenScatteredFeature.Start(this.worldObj, this.rand, chunkX, chunkZ); } - public boolean hasMageHut(BlockPos pos) + public boolean hasMageHut(LocalPos pos) { StructureStart structurestart = this.func_175797_c(pos); diff --git a/server/src/main/java/server/worldgen/structure/MapGenStructure.java b/server/src/main/java/server/worldgen/structure/MapGenStructure.java index 5f6c0d5d..9a5e94ee 100755 --- a/server/src/main/java/server/worldgen/structure/MapGenStructure.java +++ b/server/src/main/java/server/worldgen/structure/MapGenStructure.java @@ -6,7 +6,7 @@ import java.util.Map; import common.collect.Maps; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ChunkPos; import common.util.LongHashMap; import common.world.World; @@ -69,13 +69,13 @@ public abstract class MapGenStructure extends MapGenBase return flag; } - public boolean isPresent(BlockPos pos) + public boolean isPresent(LocalPos pos) { this.initializeStructureData(this.worldObj); return this.func_175797_c(pos) != null; } - protected StructureStart func_175797_c(BlockPos pos) + protected StructureStart func_175797_c(LocalPos pos) { label24: @@ -107,7 +107,7 @@ public abstract class MapGenStructure extends MapGenBase return null; } - public boolean isPositionInStructure(WorldServer worldIn, BlockPos pos) + public boolean isPositionInStructure(WorldServer worldIn, LocalPos pos) { this.initializeStructureData(worldIn); diff --git a/server/src/main/java/server/worldgen/structure/StructureBoundingBox.java b/server/src/main/java/server/worldgen/structure/StructureBoundingBox.java index a4b81100..d5643752 100755 --- a/server/src/main/java/server/worldgen/structure/StructureBoundingBox.java +++ b/server/src/main/java/server/worldgen/structure/StructureBoundingBox.java @@ -1,6 +1,6 @@ package server.worldgen.structure; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.util.Vec3i; @@ -210,7 +210,7 @@ public class StructureBoundingBox public Vec3i getCenter() { - return new BlockPos(this.minX + (this.maxX - this.minX + 1) / 2, this.minY + (this.maxY - this.minY + 1) / 2, this.minZ + (this.maxZ - this.minZ + 1) / 2); + return new LocalPos(this.minX + (this.maxX - this.minX + 1) / 2, this.minY + (this.maxY - this.minY + 1) / 2, this.minZ + (this.maxZ - this.minZ + 1) / 2); } // public String toString() diff --git a/server/src/main/java/server/worldgen/structure/StructureBridge.java b/server/src/main/java/server/worldgen/structure/StructureBridge.java index 496972d8..1464a141 100755 --- a/server/src/main/java/server/worldgen/structure/StructureBridge.java +++ b/server/src/main/java/server/worldgen/structure/StructureBridge.java @@ -8,7 +8,7 @@ import common.entity.npc.EntityDarkMage; import common.init.Blocks; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.vars.Vars; import common.world.State; @@ -153,7 +153,7 @@ public class StructureBridge this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 1, 4, 4, Blocks.blood_brick_fence.getState(), Blocks.blood_brick.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 4, 3, 4, 4, Blocks.blood_brick_fence.getState(), Blocks.blood_brick.getState(), false); - if (this.field_111021_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + if (this.field_111021_b && structureBoundingBoxIn.isVecInside(new LocalPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) { this.field_111021_b = false; this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, LootConstants.HELL_FORTRESS, 2 + randomIn.zrange(4)); @@ -224,7 +224,7 @@ public class StructureBridge this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 1, 4, 4, Blocks.blood_brick_fence.getState(), Blocks.blood_brick.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 4, 3, 4, 4, Blocks.blood_brick_fence.getState(), Blocks.blood_brick.getState(), false); - if (this.field_111020_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) + if (this.field_111020_b && structureBoundingBoxIn.isVecInside(new LocalPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) { this.field_111020_b = false; this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, LootConstants.HELL_FORTRESS, 2 + randomIn.zrange(4)); @@ -783,7 +783,7 @@ public class StructureBridge this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 6, 6, 4, 6, Blocks.air.getState(), Blocks.air.getState(), false); this.setBlockState(worldIn, Blocks.blood_brick.getState(), 6, 0, 6, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.flowing_lava.getState(), 6, 5, 6, structureBoundingBoxIn); - BlockPos blockpos = new BlockPos(this.getXWithOffset(6, 6), this.getYWithOffset(5), this.getZWithOffset(6, 6)); + LocalPos blockpos = new LocalPos(this.getXWithOffset(6, 6), this.getYWithOffset(5), this.getZWithOffset(6, 6)); if (structureBoundingBoxIn.isVecInside(blockpos)) { @@ -1369,7 +1369,7 @@ public class StructureBridge if (!this.hasSpawner && Vars.mobs && SVars.spawnBridgeMobs) { - BlockPos blockpos = new BlockPos(this.getXWithOffset(3, 5), this.getYWithOffset(5), this.getZWithOffset(3, 5)); + LocalPos blockpos = new LocalPos(this.getXWithOffset(3, 5), this.getYWithOffset(5), this.getZWithOffset(3, 5)); if (structureBoundingBoxIn.isVecInside(blockpos)) { diff --git a/server/src/main/java/server/worldgen/structure/StructureComponent.java b/server/src/main/java/server/worldgen/structure/StructureComponent.java index 0d5da4be..0c4054fc 100755 --- a/server/src/main/java/server/worldgen/structure/StructureComponent.java +++ b/server/src/main/java/server/worldgen/structure/StructureComponent.java @@ -17,8 +17,9 @@ import common.rng.WeightedList; import common.tags.TagObject; import common.tileentity.TileEntity; import common.tileentity.TileEntityChest; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; +import common.util.MutablePos; import common.world.State; import server.world.WorldServer; @@ -128,9 +129,9 @@ public abstract class StructureComponent return null; } - public BlockPos getBoundingBoxCenter() + public LocalPos getBoundingBoxCenter() { - return new BlockPos(this.boundingBox.getCenter()); + return new LocalPos(this.boundingBox.getCenter()); } /** @@ -144,7 +145,7 @@ public abstract class StructureComponent int l = Math.min(this.boundingBox.maxX + 1, boundingboxIn.maxX); int i1 = Math.min(this.boundingBox.maxY + 1, boundingboxIn.maxY); int j1 = Math.min(this.boundingBox.maxZ + 1, boundingboxIn.maxZ); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int k1 = i; k1 <= l; ++k1) { @@ -505,7 +506,7 @@ public abstract class StructureComponent protected void setBlockState(WorldServer worldIn, State blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn) { - BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); if (boundingboxIn.isVecInside(blockpos)) { @@ -518,7 +519,7 @@ public abstract class StructureComponent int i = this.getXWithOffset(x, z); int j = this.getYWithOffset(y); int k = this.getZWithOffset(x, z); - BlockPos blockpos = new BlockPos(i, j, k); + LocalPos blockpos = new LocalPos(i, j, k); return !boundingboxIn.isVecInside(blockpos) ? Blocks.air.getState() : worldIn.getState(blockpos); } @@ -660,7 +661,7 @@ public abstract class StructureComponent */ protected void clearCurrentPositionBlocksUpwards(WorldServer worldIn, int x, int y, int z, StructureBoundingBox structurebb) { - BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); if (structurebb.isVecInside(blockpos)) { @@ -681,11 +682,11 @@ public abstract class StructureComponent int j = this.getYWithOffset(y); int k = this.getZWithOffset(x, z); - if (boundingboxIn.isVecInside(new BlockPos(i, j, k))) + if (boundingboxIn.isVecInside(new LocalPos(i, j, k))) { - while ((worldIn.isAirBlock(new BlockPos(i, j, k)) || worldIn.getState(new BlockPos(i, j, k)).getBlock().getMaterial().isLiquid()) && j > 1) + while ((worldIn.isAirBlock(new LocalPos(i, j, k)) || worldIn.getState(new LocalPos(i, j, k)).getBlock().getMaterial().isLiquid()) && j > 1) { - worldIn.setState(new BlockPos(i, j, k), blockstateIn, 2); + worldIn.setState(new LocalPos(i, j, k), blockstateIn, 2); --j; } } @@ -693,7 +694,7 @@ public abstract class StructureComponent protected boolean generateChestContents(WorldServer worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, WeightedList listIn, int max) { - BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); if (boundingBoxIn.isVecInside(blockpos) && worldIn.getState(blockpos).getBlock() != Blocks.wood_chest) { @@ -719,7 +720,7 @@ public abstract class StructureComponent */ protected void placeDoorCurrentPosition(WorldServer worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, State state) { - BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); if (boundingBoxIn.isVecInside(blockpos)) { diff --git a/server/src/main/java/server/worldgen/structure/StructureMineshaft.java b/server/src/main/java/server/worldgen/structure/StructureMineshaft.java index 2be4b73d..554217bb 100755 --- a/server/src/main/java/server/worldgen/structure/StructureMineshaft.java +++ b/server/src/main/java/server/worldgen/structure/StructureMineshaft.java @@ -15,7 +15,7 @@ import common.rng.WeightedList; import common.tags.TagObject; import common.tileentity.TileEntity; import common.tileentity.TileEntityChest; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.vars.Vars; import common.world.State; @@ -290,7 +290,7 @@ public class StructureMineshaft protected boolean generateChestContents(WorldServer worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, WeightedList listIn, int max) { - BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + LocalPos blockpos = new LocalPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); if (boundingBoxIn.isVecInside(blockpos) && worldIn.getState(blockpos).getBlock() == Blocks.air && worldIn.isBlockSolid(blockpos.down())) { @@ -370,7 +370,7 @@ public class StructureMineshaft int i2 = k1 - 1 + randomIn.zrange(3); int j2 = this.getXWithOffset(1, i2); i2 = this.getZWithOffset(1, i2); - BlockPos blockpos = new BlockPos(j2, l1, i2); + LocalPos blockpos = new LocalPos(j2, l1, i2); if (structureBoundingBoxIn.isVecInside(blockpos)) { diff --git a/server/src/main/java/server/worldgen/structure/StructureScattered.java b/server/src/main/java/server/worldgen/structure/StructureScattered.java index 695bf0ea..6de7a9b1 100755 --- a/server/src/main/java/server/worldgen/structure/StructureScattered.java +++ b/server/src/main/java/server/worldgen/structure/StructureScattered.java @@ -8,8 +8,9 @@ import common.item.RngLoot; import common.item.material.ItemEnchantedBook; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; +import common.util.MutablePos; import common.vars.Vars; import common.world.State; import server.vars.SVars; @@ -313,7 +314,7 @@ public class StructureScattered { int i = 0; int j = 0; - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k) { @@ -624,7 +625,7 @@ public class StructureScattered int i2 = this.getYWithOffset(2); int k1 = this.getZWithOffset(2, 5); - if (structureBoundingBoxIn.isVecInside(new BlockPos(l1, i2, k1))) + if (structureBoundingBoxIn.isVecInside(new LocalPos(l1, i2, k1))) { this.hasMage = true; EntityMage mage = new EntityMage(worldIn); diff --git a/server/src/main/java/server/worldgen/structure/StructureStronghold.java b/server/src/main/java/server/worldgen/structure/StructureStronghold.java index b76736b9..94a18ed8 100755 --- a/server/src/main/java/server/worldgen/structure/StructureStronghold.java +++ b/server/src/main/java/server/worldgen/structure/StructureStronghold.java @@ -15,7 +15,7 @@ import common.item.RngLoot; import common.item.material.ItemEnchantedBook; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; import common.vars.Vars; import common.world.State; @@ -301,7 +301,7 @@ public class StructureStronghold this.setBlockState(worldIn, Blocks.stonebrick_slab.getState(), 2, 1, i, structureBoundingBoxIn); } - if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new LocalPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) { this.hasMadeChest = true; this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, RngLoot.addToList(LootConstants.STRONGHOLD_CHEST, ItemEnchantedBook.getRandom(randomIn)), 2 + randomIn.zrange(2)); @@ -906,7 +906,7 @@ public class StructureStronghold if (!this.hasSpawner && Vars.mobs && SVars.spawnStrongholdMobs) { i = this.getYWithOffset(3); - BlockPos blockpos = new BlockPos(this.getXWithOffset(5, 6), i, this.getZWithOffset(5, 6)); + LocalPos blockpos = new LocalPos(this.getXWithOffset(5, 6), i, this.getZWithOffset(5, 6)); if (structureBoundingBoxIn.isVecInside(blockpos)) { @@ -1276,7 +1276,7 @@ public class StructureStronghold super(0, p_i2083_2_, p_i2083_3_, p_i2083_4_); } - public BlockPos getBoundingBoxCenter() + public LocalPos getBoundingBoxCenter() { return this.strongholdPortalRoom != null ? this.strongholdPortalRoom.getBoundingBoxCenter() : super.getBoundingBoxCenter(); } diff --git a/server/src/main/java/server/worldgen/structure/StructureVillage.java b/server/src/main/java/server/worldgen/structure/StructureVillage.java index d1da57cd..9026a109 100755 --- a/server/src/main/java/server/worldgen/structure/StructureVillage.java +++ b/server/src/main/java/server/worldgen/structure/StructureVillage.java @@ -15,8 +15,9 @@ import common.init.BlockRegistry; import common.init.Blocks; import common.rng.Random; import common.tags.TagObject; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; +import common.util.MutablePos; import common.vars.Vars; import common.world.State; import server.vars.SVars; @@ -909,7 +910,7 @@ public class StructureVillage this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.oak_stairs.getState().withProperty(BlockStairs.FACING, Facing.NORTH)), 2, 1, 5, structureBoundingBoxIn); this.setBlockState(worldIn, this.getMetadataWithOffset(Blocks.oak_stairs.getState().withProperty(BlockStairs.FACING, Facing.WEST)), 1, 1, 4, structureBoundingBoxIn); - if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) + if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new LocalPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) { this.hasMadeChest = true; this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, LootConstants.VILLAGE_BLACKSMITH, 3 + randomIn.zrange(6)); @@ -1349,7 +1350,7 @@ public class StructureVillage { for (int j = this.boundingBox.minZ; j <= this.boundingBox.maxZ; ++j) { - BlockPos blockpos = new BlockPos(i, 64, j); + LocalPos blockpos = new LocalPos(i, 64, j); if (structureBoundingBoxIn.isVecInside(blockpos)) { @@ -1555,7 +1556,7 @@ public class StructureVillage { int i = 0; int j = 0; - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k) { @@ -1596,7 +1597,7 @@ public class StructureVillage int k = this.getYWithOffset(p_74893_4_); int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_); - if (!p_74893_2_.isVecInside(new BlockPos(j, k, l))) + if (!p_74893_2_.isVecInside(new LocalPos(j, k, l))) { break; } @@ -1911,7 +1912,7 @@ public class StructureVillage int k = this.getYWithOffset(y); int l = this.getZWithOffset(x, z); - if (!p_74893_2_.isVecInside(new BlockPos(j, k, l))) + if (!p_74893_2_.isVecInside(new LocalPos(j, k, l))) { return; } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java b/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java index f7d9f3a8..a43c7cdb 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java @@ -8,7 +8,8 @@ import common.init.Blocks; import common.init.WoodType; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; +import common.util.MutablePos; import common.world.State; import server.world.WorldServer; @@ -41,7 +42,7 @@ public class WorldGenBaseTree extends WorldGenTree this.vinesGrow = vines; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { int i = rand.zrange(3) + this.minTreeHeight; boolean flag = true; @@ -62,7 +63,7 @@ public class WorldGenBaseTree extends WorldGenTree k = 2; } - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) { @@ -112,7 +113,7 @@ public class WorldGenBaseTree extends WorldGenTree if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.zrange(2) != 0 && i4 != 0) { - BlockPos blockpos = new BlockPos(k1, i3, i2); + LocalPos blockpos = new LocalPos(k1, i3, i2); Block block = worldIn.getState(blockpos).getBlock(); if (block == Blocks.air || block.getMaterial() == Material.LEAVES || block.getMaterial() == Material.BUSH) @@ -163,7 +164,7 @@ public class WorldGenBaseTree extends WorldGenTree { int j4 = k3 - (position.getY() + i); int k4 = 2 - j4 / 2; - BlockPos.MutableBlockPos blockpos$mutableblockpos1 = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos1 = new MutablePos(); for (int l4 = position.getX() - k4; l4 <= position.getX() + k4; ++l4) { @@ -173,10 +174,10 @@ public class WorldGenBaseTree extends WorldGenTree if (worldIn.getState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.LEAVES) { - BlockPos blockpos2 = blockpos$mutableblockpos1.west(); - BlockPos blockpos3 = blockpos$mutableblockpos1.east(); - BlockPos blockpos4 = blockpos$mutableblockpos1.north(); - BlockPos blockpos1 = blockpos$mutableblockpos1.south(); + LocalPos blockpos2 = blockpos$mutableblockpos1.west(); + LocalPos blockpos3 = blockpos$mutableblockpos1.east(); + LocalPos blockpos4 = blockpos$mutableblockpos1.north(); + LocalPos blockpos1 = blockpos$mutableblockpos1.south(); if (rand.zrange(4) == 0 && worldIn.getState(blockpos2).getBlock() == Blocks.air) { @@ -217,12 +218,12 @@ public class WorldGenBaseTree extends WorldGenTree } } - private void func_181651_a(WorldServer p_181651_1_, BlockPos p_181651_2_, PropertyBool p_181651_3_) + private void func_181651_a(WorldServer p_181651_1_, LocalPos p_181651_2_, PropertyBool p_181651_3_) { this.setBlockNotify(p_181651_1_, p_181651_2_, Blocks.vine.getState().withProperty(p_181651_3_, Boolean.valueOf(true))); } - private void func_181650_b(WorldServer p_181650_1_, BlockPos p_181650_2_, PropertyBool p_181650_3_) + private void func_181650_b(WorldServer p_181650_1_, LocalPos p_181650_2_, PropertyBool p_181650_3_) { this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); int i = 4; diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java b/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java index c0d45066..1f6573c5 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java @@ -10,7 +10,7 @@ import common.collect.Lists; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.util.Facing; import common.world.State; @@ -23,7 +23,7 @@ public class WorldGenBigTree extends WorldGenTree private Random rand; private WorldServer world; - private BlockPos basePos = BlockPos.ORIGIN; + private LocalPos basePos = LocalPos.ORIGIN; private int heightLimit; private int height; double heightAttenuation = 0.618D; @@ -34,7 +34,7 @@ public class WorldGenBigTree extends WorldGenTree private int heightLimitLower = 5; private int heightLimitLimit = 16; private int leafDistanceLimit = 4; - List field_175948_j; + List field_175948_j; public WorldGenBigTree(boolean notify, State logBase, WoodType leavesBase) { @@ -80,8 +80,8 @@ public class WorldGenBigTree extends WorldGenTree int j = this.basePos.getY() + this.height; int k = this.heightLimit - this.leafDistanceLimit; - this.field_175948_j = Lists.newArrayList(); - this.field_175948_j.add(new WorldGenBigTree.FoliageCoordinates(this.basePos.up(k), j)); + this.field_175948_j = Lists.newArrayList(); + this.field_175948_j.add(new WorldGenBigTree.LeafPos(this.basePos.up(k), j)); for (; k >= 0; --k) { @@ -95,8 +95,8 @@ public class WorldGenBigTree extends WorldGenTree double d1 = (double)(this.rand.floatv() * 2.0F) * Math.PI; double d2 = d0 * Math.sin(d1) + 0.5D; double d3 = d0 * Math.cos(d1) + 0.5D; - BlockPos blockpos = this.basePos.add(d2, (double)(k - 1), d3); - BlockPos blockpos1 = blockpos.up(this.leafDistanceLimit); + LocalPos blockpos = this.basePos.add(d2, (double)(k - 1), d3); + LocalPos blockpos1 = blockpos.up(this.leafDistanceLimit); if (this.checkBlockLine(blockpos, blockpos1) == -1) { @@ -104,11 +104,11 @@ public class WorldGenBigTree extends WorldGenTree int j1 = this.basePos.getZ() - blockpos.getZ(); double d4 = (double)blockpos.getY() - Math.sqrt((double)(i1 * i1 + j1 * j1)) * this.branchSlope; int k1 = d4 > (double)j ? j : (int)d4; - BlockPos blockpos2 = new BlockPos(this.basePos.getX(), k1, this.basePos.getZ()); + LocalPos blockpos2 = new LocalPos(this.basePos.getX(), k1, this.basePos.getZ()); if (this.checkBlockLine(blockpos2, blockpos) == -1) { - this.field_175948_j.add(new WorldGenBigTree.FoliageCoordinates(blockpos, blockpos2.getY())); + this.field_175948_j.add(new WorldGenBigTree.LeafPos(blockpos, blockpos2.getY())); } } } @@ -116,7 +116,7 @@ public class WorldGenBigTree extends WorldGenTree } } - void func_181631_a(BlockPos p_181631_1_, float p_181631_2_, State p_181631_3_) + void func_181631_a(LocalPos p_181631_1_, float p_181631_2_, State p_181631_3_) { int i = (int)((double)p_181631_2_ + 0.618D); @@ -126,7 +126,7 @@ public class WorldGenBigTree extends WorldGenTree { if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) { - BlockPos blockpos = p_181631_1_.add(j, 0, k); + LocalPos blockpos = p_181631_1_.add(j, 0, k); Block block = this.world.getState(blockpos).getBlock(); if (block == Blocks.air || block.getMaterial() == Material.LEAVES) @@ -174,7 +174,7 @@ public class WorldGenBigTree extends WorldGenTree /** * Generates the leaves surrounding an individual entry in the leafNodes list. */ - void generateLeafNode(BlockPos pos) + void generateLeafNode(LocalPos pos) { for (int i = 0; i < this.leafDistanceLimit; ++i) { @@ -182,9 +182,9 @@ public class WorldGenBigTree extends WorldGenTree } } - void func_175937_a(BlockPos p_175937_1_, BlockPos p_175937_2_) + void func_175937_a(LocalPos p_175937_1_, LocalPos p_175937_2_) { - BlockPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ()); + LocalPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ()); int i = this.getGreatestDistance(blockpos); float f = (float)blockpos.getX() / (float)i; float f1 = (float)blockpos.getY() / (float)i; @@ -192,7 +192,7 @@ public class WorldGenBigTree extends WorldGenTree for (int j = 0; j <= i; ++j) { - BlockPos blockpos1 = p_175937_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + LocalPos blockpos1 = p_175937_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); Facing.Axis blocklog$enumaxis = this.func_175938_b(p_175937_1_, blockpos1); this.setBlockNotify(this.world, blockpos1, this.logBase.withProperty(BlockLog.AXIS, blocklog$enumaxis)); } @@ -201,7 +201,7 @@ public class WorldGenBigTree extends WorldGenTree /** * Returns the absolute greatest distance in the BlockPos object. */ - private int getGreatestDistance(BlockPos posIn) + private int getGreatestDistance(LocalPos posIn) { int i = ExtMath.absi(posIn.getX()); int j = ExtMath.absi(posIn.getY()); @@ -209,7 +209,7 @@ public class WorldGenBigTree extends WorldGenTree return k > i && k > j ? k : (j > i ? j : i); } - private Facing.Axis func_175938_b(BlockPos p_175938_1_, BlockPos p_175938_2_) + private Facing.Axis func_175938_b(LocalPos p_175938_1_, LocalPos p_175938_2_) { Facing.Axis blocklog$enumaxis = Facing.Axis.Y; int i = Math.abs(p_175938_2_.getX() - p_175938_1_.getX()); @@ -236,7 +236,7 @@ public class WorldGenBigTree extends WorldGenTree */ void generateLeaves() { - for (WorldGenBigTree.FoliageCoordinates worldgenbigtree$foliagecoordinates : this.field_175948_j) + for (WorldGenBigTree.LeafPos worldgenbigtree$foliagecoordinates : this.field_175948_j) { this.generateLeafNode(worldgenbigtree$foliagecoordinates); } @@ -256,8 +256,8 @@ public class WorldGenBigTree extends WorldGenTree */ void generateTrunk() { - BlockPos blockpos = this.basePos; - BlockPos blockpos1 = this.basePos.up(this.height); + LocalPos blockpos = this.basePos; + LocalPos blockpos1 = this.basePos.up(this.height); this.func_175937_a(blockpos, blockpos1); if (this.trunkSize == 2) @@ -273,10 +273,10 @@ public class WorldGenBigTree extends WorldGenTree */ void generateLeafNodeBases() { - for (WorldGenBigTree.FoliageCoordinates worldgenbigtree$foliagecoordinates : this.field_175948_j) + for (WorldGenBigTree.LeafPos worldgenbigtree$foliagecoordinates : this.field_175948_j) { - int i = worldgenbigtree$foliagecoordinates.func_177999_q(); - BlockPos blockpos = new BlockPos(this.basePos.getX(), i, this.basePos.getZ()); + int i = worldgenbigtree$foliagecoordinates.getHeight(); + LocalPos blockpos = new LocalPos(this.basePos.getX(), i, this.basePos.getZ()); if (!blockpos.equals(worldgenbigtree$foliagecoordinates) && this.leafNodeNeedsBase(i - this.basePos.getY())) { @@ -289,9 +289,9 @@ public class WorldGenBigTree extends WorldGenTree * Checks a line of blocks in the world from the first coordinate to triplet to the second, returning the distance * (in blocks) before a non-air, non-leaf block is encountered and/or the end is encountered. */ - int checkBlockLine(BlockPos posOne, BlockPos posTwo) + int checkBlockLine(LocalPos posOne, LocalPos posTwo) { - BlockPos blockpos = posTwo.add(-posOne.getX(), -posOne.getY(), -posOne.getZ()); + LocalPos blockpos = posTwo.add(-posOne.getX(), -posOne.getY(), -posOne.getZ()); int i = this.getGreatestDistance(blockpos); float f = (float)blockpos.getX() / (float)i; float f1 = (float)blockpos.getY() / (float)i; @@ -305,7 +305,7 @@ public class WorldGenBigTree extends WorldGenTree { for (int j = 0; j <= i; ++j) { - BlockPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + LocalPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); if (!this.canBeReplaced(this.world.getState(blockpos1).getBlock())) { @@ -323,7 +323,7 @@ public class WorldGenBigTree extends WorldGenTree this.leafDistanceLimit = 5; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { this.world = worldIn; this.basePos = position; @@ -380,19 +380,16 @@ public class WorldGenBigTree extends WorldGenTree } } - static class FoliageCoordinates extends BlockPos - { - private final int field_178000_b; + private static class LeafPos extends LocalPos { + private final int height; - public FoliageCoordinates(BlockPos p_i45635_1_, int p_i45635_2_) - { - super(p_i45635_1_.getX(), p_i45635_1_.getY(), p_i45635_1_.getZ()); - this.field_178000_b = p_i45635_2_; - } + public LeafPos(LocalPos pos, int height) { + super(pos.getX(), pos.getY(), pos.getZ()); + this.height = height; + } - public int func_177999_q() - { - return this.field_178000_b; - } - } + public int getHeight() { + return this.height; + } + } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBirch.java b/server/src/main/java/server/worldgen/tree/WorldGenBirch.java index 9d648ffb..b6cfaef2 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBirch.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBirch.java @@ -6,7 +6,8 @@ import common.block.foliage.BlockLeaves; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; +import common.util.MutablePos; import common.world.State; import server.world.WorldServer; @@ -23,7 +24,7 @@ public class WorldGenBirch extends WorldGenTree this.useExtraRandomHeight = extra; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { int i = rand.zrange(3) + 5; @@ -50,7 +51,7 @@ public class WorldGenBirch extends WorldGenTree k = 2; } - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) { @@ -98,7 +99,7 @@ public class WorldGenBirch extends WorldGenTree if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || rand.zrange(2) != 0 && k2 != 0) { - BlockPos blockpos = new BlockPos(i3, i2, k1); + LocalPos blockpos = new LocalPos(i3, i2, k1); Block block = worldIn.getState(blockpos).getBlock(); if (block == Blocks.air || block.getMaterial() == Material.LEAVES) diff --git a/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java b/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java index 86afa98b..bc7f9068 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java @@ -6,8 +6,9 @@ import common.block.foliage.BlockLeaves; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; +import common.util.MutablePos; import common.world.State; import server.world.WorldServer; @@ -22,7 +23,7 @@ public class WorldGenDarkOak extends WorldGenTree super(notify); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { int i = rand.zrange(3) + rand.zrange(2) + 6; int j = position.getX(); @@ -31,7 +32,7 @@ public class WorldGenDarkOak extends WorldGenTree if (k >= 1 && k + i + 1 < 512) { - BlockPos blockpos = position.down(); + LocalPos blockpos = position.down(); Block block = worldIn.getState(blockpos).getBlock(); if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.coarse_dirt && block != Blocks.podzol) @@ -65,7 +66,7 @@ public class WorldGenDarkOak extends WorldGenTree } int k2 = k + j2; - BlockPos blockpos1 = new BlockPos(k1, k2, l1); + LocalPos blockpos1 = new LocalPos(k1, k2, l1); Block block1 = worldIn.getState(blockpos1).getBlock(); if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES) @@ -127,7 +128,7 @@ public class WorldGenDarkOak extends WorldGenTree for (int i5 = 0; i5 < l4; ++i5) { - this.func_181639_b(worldIn, new BlockPos(j + k3, i2 - i5 - 1, l + j4)); + this.func_181639_b(worldIn, new LocalPos(j + k3, i2 - i5 - 1, l + j4)); } for (int j5 = -1; j5 <= 1; ++j5) @@ -161,12 +162,12 @@ public class WorldGenDarkOak extends WorldGenTree } } - private boolean func_181638_a(WorldServer p_181638_1_, BlockPos p_181638_2_, int p_181638_3_) + private boolean func_181638_a(WorldServer p_181638_1_, LocalPos p_181638_2_, int p_181638_3_) { int i = p_181638_2_.getX(); int j = p_181638_2_.getY(); int k = p_181638_2_.getZ(); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int l = 0; l <= p_181638_3_ + 1; ++l) { @@ -197,7 +198,7 @@ public class WorldGenDarkOak extends WorldGenTree return true; } - private void func_181639_b(WorldServer p_181639_1_, BlockPos p_181639_2_) + private void func_181639_b(WorldServer p_181639_1_, LocalPos p_181639_2_) { if (this.canBeReplaced(p_181639_1_.getState(p_181639_2_).getBlock())) { @@ -207,7 +208,7 @@ public class WorldGenDarkOak extends WorldGenTree private void func_150526_a(WorldServer worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) { - BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); + LocalPos blockpos = new LocalPos(p_150526_2_, p_150526_3_, p_150526_4_); Block block = worldIn.getState(blockpos).getBlock(); if (block == Blocks.air) diff --git a/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java b/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java index e772e4c0..f3c82bb5 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java @@ -6,7 +6,7 @@ import common.block.foliage.BlockLeaves; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.world.State; import server.world.WorldServer; @@ -43,7 +43,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree return i; } - private boolean func_175926_c(WorldServer worldIn, BlockPos p_175926_2_, int p_175926_3_) + private boolean func_175926_c(WorldServer worldIn, LocalPos p_175926_2_, int p_175926_3_) { boolean flag = true; @@ -82,9 +82,9 @@ public abstract class WorldGenHugeTree extends WorldGenTree } } - private boolean func_175927_a(BlockPos p_175927_1_, WorldServer worldIn) + private boolean func_175927_a(LocalPos p_175927_1_, WorldServer worldIn) { - BlockPos blockpos = p_175927_1_.down(); + LocalPos blockpos = p_175927_1_.down(); Block block = worldIn.getState(blockpos).getBlock(); if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.coarse_dirt || block == Blocks.podzol) && p_175927_1_.getY() >= 2) @@ -101,12 +101,12 @@ public abstract class WorldGenHugeTree extends WorldGenTree } } - protected boolean func_175929_a(WorldServer worldIn, Random p_175929_2_, BlockPos p_175929_3_, int p_175929_4_) + protected boolean func_175929_a(WorldServer worldIn, Random p_175929_2_, LocalPos p_175929_3_, int p_175929_4_) { return this.func_175926_c(worldIn, p_175929_3_, p_175929_4_) && this.func_175927_a(p_175929_3_, worldIn); } - protected void func_175925_a(WorldServer worldIn, BlockPos p_175925_2_, int p_175925_3_) + protected void func_175925_a(WorldServer worldIn, LocalPos p_175925_2_, int p_175925_3_) { int i = p_175925_3_ * p_175925_3_; @@ -119,7 +119,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) { - BlockPos blockpos = p_175925_2_.add(j, 0, k); + LocalPos blockpos = p_175925_2_.add(j, 0, k); Block block = worldIn.getState(blockpos).getBlock(); if (block == Blocks.air || block.getMaterial() == Material.LEAVES) @@ -131,7 +131,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree } } - protected void func_175928_b(WorldServer worldIn, BlockPos p_175928_2_, int p_175928_3_) + protected void func_175928_b(WorldServer worldIn, LocalPos p_175928_2_, int p_175928_3_) { int i = p_175928_3_ * p_175928_3_; @@ -141,7 +141,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree { if (j * j + k * k <= i) { - BlockPos blockpos = p_175928_2_.add(j, 0, k); + LocalPos blockpos = p_175928_2_.add(j, 0, k); Block block = worldIn.getState(blockpos).getBlock(); if (block == Blocks.air || block.getMaterial() == Material.LEAVES) diff --git a/server/src/main/java/server/worldgen/tree/WorldGenJungle.java b/server/src/main/java/server/worldgen/tree/WorldGenJungle.java index 154b6234..704b8a46 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenJungle.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenJungle.java @@ -5,7 +5,7 @@ import common.init.Blocks; import common.init.WoodType; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.world.State; import server.world.WorldServer; @@ -17,7 +17,7 @@ public class WorldGenJungle extends WorldGenHugeTree super(p_i46448_1_, p_i46448_2_, p_i46448_3_, p_i46448_4_, p_i46448_5_); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { int i = this.func_150533_a(rand); @@ -39,7 +39,7 @@ public class WorldGenJungle extends WorldGenHugeTree { k = position.getX() + (int)(1.5F + ExtMath.cos(f) * (float)i1); l = position.getZ() + (int)(1.5F + ExtMath.sin(f) * (float)i1); - this.setBlockNotify(worldIn, new BlockPos(k, j - 3 + i1 / 2, l), this.woodMetadata); + this.setBlockNotify(worldIn, new LocalPos(k, j - 3 + i1 / 2, l), this.woodMetadata); } int j2 = 1 + rand.zrange(2); @@ -48,13 +48,13 @@ public class WorldGenJungle extends WorldGenHugeTree for (int k1 = j - j2; k1 <= j1; ++k1) { int l1 = k1 - j1; - this.func_175928_b(worldIn, new BlockPos(k, k1, l), 1 - l1); + this.func_175928_b(worldIn, new LocalPos(k, k1, l), 1 - l1); } } for (int i2 = 0; i2 < i; ++i2) { - BlockPos blockpos = position.up(i2); + LocalPos blockpos = position.up(i2); if (this.canBeReplaced(worldIn.getState(blockpos).getBlock())) { @@ -69,7 +69,7 @@ public class WorldGenJungle extends WorldGenHugeTree if (i2 < i - 1) { - BlockPos blockpos1 = blockpos.east(); + LocalPos blockpos1 = blockpos.east(); if (this.canBeReplaced(worldIn.getState(blockpos1).getBlock())) { @@ -82,7 +82,7 @@ public class WorldGenJungle extends WorldGenHugeTree } } - BlockPos blockpos2 = blockpos.south().east(); + LocalPos blockpos2 = blockpos.south().east(); if (this.canBeReplaced(worldIn.getState(blockpos2).getBlock())) { @@ -95,7 +95,7 @@ public class WorldGenJungle extends WorldGenHugeTree } } - BlockPos blockpos3 = blockpos.south(); + LocalPos blockpos3 = blockpos.south(); if (this.canBeReplaced(worldIn.getState(blockpos3).getBlock())) { @@ -114,7 +114,7 @@ public class WorldGenJungle extends WorldGenHugeTree } } - private void func_181632_a(WorldServer p_181632_1_, Random p_181632_2_, BlockPos p_181632_3_, PropertyBool p_181632_4_) + private void func_181632_a(WorldServer p_181632_1_, Random p_181632_2_, LocalPos p_181632_3_, PropertyBool p_181632_4_) { if (p_181632_2_.zrange(3) > 0 && p_181632_1_.isAirBlock(p_181632_3_)) { @@ -122,7 +122,7 @@ public class WorldGenJungle extends WorldGenHugeTree } } - private void func_175930_c(WorldServer worldIn, BlockPos p_175930_2_, int p_175930_3_) + private void func_175930_c(WorldServer worldIn, LocalPos p_175930_2_, int p_175930_3_) { int i = 2; diff --git a/server/src/main/java/server/worldgen/tree/WorldGenPine.java b/server/src/main/java/server/worldgen/tree/WorldGenPine.java index ef43c14b..dad00a58 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenPine.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenPine.java @@ -5,7 +5,7 @@ import common.block.Material; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.ExtMath; import common.world.State; import server.world.WorldServer; @@ -24,7 +24,7 @@ public class WorldGenPine extends WorldGenHugeTree this.useBaseHeight = p_i45457_2_; } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { int i = this.func_150533_a(rand); @@ -83,12 +83,12 @@ public class WorldGenPine extends WorldGenHugeTree { int l = p_150541_4_ - k; int i1 = p_150541_5_ + ExtMath.floorf((float)l / (float)i * 3.5F); - this.func_175925_a(worldIn, new BlockPos(p_150541_2_, k, p_150541_3_), i1 + (l > 0 && i1 == j && (k & 1) == 0 ? 1 : 0)); + this.func_175925_a(worldIn, new LocalPos(p_150541_2_, k, p_150541_3_), i1 + (l > 0 && i1 == j && (k & 1) == 0 ? 1 : 0)); j = i1; } } - public void finish(WorldServer worldIn, Random p_180711_2_, BlockPos p_180711_3_) + public void finish(WorldServer worldIn, Random p_180711_2_, LocalPos p_180711_3_) { this.func_175933_b(worldIn, p_180711_3_.west().north()); this.func_175933_b(worldIn, p_180711_3_.east(2).north()); @@ -108,7 +108,7 @@ public class WorldGenPine extends WorldGenHugeTree } } - private void func_175933_b(WorldServer worldIn, BlockPos p_175933_2_) + private void func_175933_b(WorldServer worldIn, LocalPos p_175933_2_) { for (int i = -2; i <= 2; ++i) { @@ -122,11 +122,11 @@ public class WorldGenPine extends WorldGenHugeTree } } - private void func_175934_c(WorldServer worldIn, BlockPos p_175934_2_) + private void func_175934_c(WorldServer worldIn, LocalPos p_175934_2_) { for (int i = 2; i >= -3; --i) { - BlockPos blockpos = p_175934_2_.up(i); + LocalPos blockpos = p_175934_2_.up(i); Block block = worldIn.getState(blockpos).getBlock(); if (block == Blocks.grass || block == Blocks.dirt || block == Blocks.coarse_dirt || block == Blocks.podzol) diff --git a/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java b/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java index 0e4bbabd..9326d734 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java @@ -6,8 +6,9 @@ import common.block.foliage.BlockLeaves; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import common.util.Facing; +import common.util.MutablePos; import common.world.State; import server.world.WorldServer; @@ -23,7 +24,7 @@ public class WorldGenSavanna extends WorldGenTree super(p_i45463_1_); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { int i = rand.zrange(3) + rand.zrange(3) + 5; boolean flag = true; @@ -44,7 +45,7 @@ public class WorldGenSavanna extends WorldGenTree k = 2; } - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) { @@ -94,7 +95,7 @@ public class WorldGenSavanna extends WorldGenTree --l2; } - BlockPos blockpos = new BlockPos(i3, i2, j1); + LocalPos blockpos = new LocalPos(i3, i2, j1); Block block1 = worldIn.getState(blockpos).getBlock(); if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES) @@ -104,7 +105,7 @@ public class WorldGenSavanna extends WorldGenTree } } - BlockPos blockpos2 = new BlockPos(i3, k1, j1); + LocalPos blockpos2 = new LocalPos(i3, k1, j1); for (int j3 = -3; j3 <= 3; ++j3) { @@ -148,7 +149,7 @@ public class WorldGenSavanna extends WorldGenTree int j2 = position.getY() + l4; i3 += enumfacing1.getFrontOffsetX(); j1 += enumfacing1.getFrontOffsetZ(); - BlockPos blockpos1 = new BlockPos(i3, j2, j1); + LocalPos blockpos1 = new LocalPos(i3, j2, j1); Block block1 = worldIn.getState(blockpos1).getBlock(); if (block1 == Blocks.air || block1.getMaterial() == Material.LEAVES) @@ -163,7 +164,7 @@ public class WorldGenSavanna extends WorldGenTree if (k1 > 0) { - BlockPos blockpos3 = new BlockPos(i3, k1, j1); + LocalPos blockpos3 = new LocalPos(i3, k1, j1); for (int i5 = -2; i5 <= 2; ++i5) { @@ -202,12 +203,12 @@ public class WorldGenSavanna extends WorldGenTree } } - private void func_181642_b(WorldServer p_181642_1_, BlockPos p_181642_2_) + private void func_181642_b(WorldServer p_181642_1_, LocalPos p_181642_2_) { this.setBlockNotify(p_181642_1_, p_181642_2_, field_181643_a); } - private void func_175924_b(WorldServer worldIn, BlockPos p_175924_2_) + private void func_175924_b(WorldServer worldIn, LocalPos p_175924_2_) { Block block = worldIn.getState(p_175924_2_).getBlock(); diff --git a/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java b/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java index c2209996..e3428728 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java @@ -8,7 +8,8 @@ import common.init.Blocks; import common.init.WoodType; import common.properties.PropertyBool; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; +import common.util.MutablePos; import common.world.State; import server.world.WorldServer; @@ -24,7 +25,7 @@ public class WorldGenSwamp extends WorldGenTree super(false); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { int i; @@ -51,7 +52,7 @@ public class WorldGenSwamp extends WorldGenTree k = 3; } - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) { @@ -108,7 +109,7 @@ public class WorldGenSwamp extends WorldGenTree if (Math.abs(l3) != i3 || Math.abs(k1) != i3 || rand.zrange(2) != 0 && k2 != 0) { - BlockPos blockpos = new BlockPos(k3, l1, j1); + LocalPos blockpos = new LocalPos(k3, l1, j1); if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { @@ -133,7 +134,7 @@ public class WorldGenSwamp extends WorldGenTree { int l2 = j2 - (position.getY() + i); int j3 = 2 - l2 / 2; - BlockPos.MutableBlockPos blockpos$mutableblockpos1 = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos1 = new MutablePos(); for (int i4 = position.getX() - j3; i4 <= position.getX() + j3; ++i4) { @@ -143,10 +144,10 @@ public class WorldGenSwamp extends WorldGenTree if (worldIn.getState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.LEAVES) { - BlockPos blockpos3 = blockpos$mutableblockpos1.west(); - BlockPos blockpos4 = blockpos$mutableblockpos1.east(); - BlockPos blockpos1 = blockpos$mutableblockpos1.north(); - BlockPos blockpos2 = blockpos$mutableblockpos1.south(); + LocalPos blockpos3 = blockpos$mutableblockpos1.west(); + LocalPos blockpos4 = blockpos$mutableblockpos1.east(); + LocalPos blockpos1 = blockpos$mutableblockpos1.north(); + LocalPos blockpos2 = blockpos$mutableblockpos1.south(); if (rand.zrange(4) == 0 && worldIn.getState(blockpos3).getBlock() == Blocks.air) { @@ -186,7 +187,7 @@ public class WorldGenSwamp extends WorldGenTree } } - private void func_181647_a(WorldServer p_181647_1_, BlockPos p_181647_2_, PropertyBool p_181647_3_) + private void func_181647_a(WorldServer p_181647_1_, LocalPos p_181647_2_, PropertyBool p_181647_3_) { State iblockstate = Blocks.swamp_vine.getState().withProperty(p_181647_3_, Boolean.valueOf(true)); this.setBlockNotify(p_181647_1_, p_181647_2_, iblockstate); diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java b/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java index 059f9324..7d0263b6 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java @@ -6,7 +6,8 @@ import common.block.foliage.BlockLeaves; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; +import common.util.MutablePos; import common.world.State; import server.world.WorldServer; @@ -22,7 +23,7 @@ public class WorldGenTaiga1 extends WorldGenTree super(false); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { int i = rand.zrange(5) + 7; int j = i - rand.zrange(2) - 3; @@ -45,7 +46,7 @@ public class WorldGenTaiga1 extends WorldGenTree j1 = l; } - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int k1 = position.getX() - j1; k1 <= position.getX() + j1 && flag; ++k1) { @@ -91,7 +92,7 @@ public class WorldGenTaiga1 extends WorldGenTree if (Math.abs(k3) != k2 || Math.abs(j2) != k2 || k2 <= 0) { - BlockPos blockpos = new BlockPos(j3, l2, i2); + LocalPos blockpos = new LocalPos(j3, l2, i2); if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java b/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java index 2d9bfad8..87023beb 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java @@ -6,7 +6,8 @@ import common.block.foliage.BlockLeaves; import common.init.Blocks; import common.init.WoodType; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; +import common.util.MutablePos; import common.world.State; import server.world.WorldServer; @@ -22,7 +23,7 @@ public class WorldGenTaiga2 extends WorldGenTree super(p_i2025_1_); } - public boolean generate(WorldServer worldIn, Random rand, BlockPos position) + public boolean generate(WorldServer worldIn, Random rand, LocalPos position) { int i = rand.zrange(4) + 6; int j = 1 + rand.zrange(2); @@ -45,7 +46,7 @@ public class WorldGenTaiga2 extends WorldGenTree j1 = l; } - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + MutablePos blockpos$mutableblockpos = new MutablePos(); for (int k1 = position.getX() - j1; k1 <= position.getX() + j1 && flag; ++k1) { @@ -97,7 +98,7 @@ public class WorldGenTaiga2 extends WorldGenTree if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0) { - BlockPos blockpos = new BlockPos(i2, j4, k2); + LocalPos blockpos = new LocalPos(i2, j4, k2); if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTree.java b/server/src/main/java/server/worldgen/tree/WorldGenTree.java index 6a1238a6..e49e2440 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTree.java @@ -7,7 +7,7 @@ import common.block.foliage.BlockSapling; import common.block.foliage.BlockVine; import common.init.Blocks; import common.rng.Random; -import common.util.BlockPos; +import common.util.LocalPos; import server.world.WorldServer; import server.worldgen.FeatureGenerator; @@ -27,11 +27,11 @@ public abstract class WorldGenTree extends FeatureGenerator { } - public void finish(WorldServer worldIn, Random random, BlockPos pos) + public void finish(WorldServer worldIn, Random random, LocalPos pos) { } - protected void setBaseBlock(WorldServer worldIn, BlockPos pos) + protected void setBaseBlock(WorldServer worldIn, LocalPos pos) { if (worldIn.getState(pos) != worldIn.gen.getTop()) {